Skip to content

Commit 25faab9

Browse files
committed
Fixes devlooped#278. Only fixes some of the issue though. Also adds new VB test assembly, hopefully in a way people will be happy with
1 parent ffcaf6e commit 25faab9

13 files changed

+503
-6
lines changed

Moq.VisualBasicTests/IssueReports.vb

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Imports Moq
2+
Imports Xunit
3+
4+
5+
6+
Public Class IssueReports
7+
8+
Public Class Issue278
9+
10+
<Fact()>
11+
Public Sub SetupsForPropertiesWithMultipleArgsDoNotOverwriteEachOther()
12+
Dim mock As New Mock(Of ISimpleInterface)()
13+
14+
mock.Setup(Function(m) m.PropertyWithMultipleArgs(1, 1)).Returns(1)
15+
mock.Setup(Function(m) m.PropertyWithMultipleArgs(1, 2)).Returns(2)
16+
17+
Assert.Equal(1, mock.Object.PropertyWithMultipleArgs(1, 1))
18+
Assert.Equal(2, mock.Object.PropertyWithMultipleArgs(1, 2))
19+
20+
End Sub
21+
22+
Public Interface ISimpleInterface
23+
24+
ReadOnly Property PropertyWithMultipleArgs(setting As Integer, setting2 As Integer) As Integer
25+
26+
End Interface
27+
End Class
28+
29+
End Class
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{95F2E2B2-2E06-4AC7-A86F-9B1B6369D4AD}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<RootNamespace>Moq.VisualBasicTests</RootNamespace>
10+
<AssemblyName>Moq.VisualBasicTests</AssemblyName>
11+
<FileAlignment>512</FileAlignment>
12+
<MyType>Windows</MyType>
13+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
14+
<RestorePackages>true</RestorePackages>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<DebugSymbols>true</DebugSymbols>
18+
<DebugType>full</DebugType>
19+
<DefineDebug>true</DefineDebug>
20+
<DefineTrace>true</DefineTrace>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DocumentationFile>Moq.VisualBasicTests.xml</DocumentationFile>
23+
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
24+
</PropertyGroup>
25+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
26+
<DebugType>pdbonly</DebugType>
27+
<DefineDebug>false</DefineDebug>
28+
<DefineTrace>true</DefineTrace>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DocumentationFile>Moq.VisualBasicTests.xml</DocumentationFile>
32+
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
33+
</PropertyGroup>
34+
<PropertyGroup>
35+
<OptionExplicit>On</OptionExplicit>
36+
</PropertyGroup>
37+
<PropertyGroup>
38+
<OptionCompare>Binary</OptionCompare>
39+
</PropertyGroup>
40+
<PropertyGroup>
41+
<OptionStrict>On</OptionStrict>
42+
</PropertyGroup>
43+
<PropertyGroup>
44+
<OptionInfer>On</OptionInfer>
45+
</PropertyGroup>
46+
<ItemGroup>
47+
<ProjectReference Include="..\Source\Moq.csproj">
48+
<Project>{1C91AC30-5977-4BE5-BA67-8EB186C03514}</Project>
49+
<Name>Moq</Name>
50+
</ProjectReference>
51+
<Reference Include="nunit.framework, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
52+
<SpecificVersion>False</SpecificVersion>
53+
<HintPath>..\..\..\..\..\..\..\AssembliesTPS\nunit.framework.dll</HintPath>
54+
</Reference>
55+
<Reference Include="System" />
56+
<Reference Include="System.Data" />
57+
<Reference Include="System.Xml" />
58+
<Reference Include="System.Core" />
59+
<Reference Include="System.Xml.Linq" />
60+
<Reference Include="System.Data.DataSetExtensions" />
61+
<Reference Include="System.Net.Http" />
62+
</ItemGroup>
63+
<ItemGroup>
64+
<Import Include="Microsoft.VisualBasic" />
65+
<Import Include="System" />
66+
<Import Include="System.Collections" />
67+
<Import Include="System.Collections.Generic" />
68+
<Import Include="System.Data" />
69+
<Import Include="System.Diagnostics" />
70+
<Import Include="System.Linq" />
71+
<Import Include="System.Xml.Linq" />
72+
<Import Include="System.Threading.Tasks" />
73+
</ItemGroup>
74+
<ItemGroup>
75+
<Compile Include="IssueReports.vb" />
76+
<Compile Include="My Project\AssemblyInfo.vb" />
77+
<Compile Include="My Project\Application.Designer.vb">
78+
<AutoGen>True</AutoGen>
79+
<DependentUpon>Application.myapp</DependentUpon>
80+
</Compile>
81+
<Compile Include="My Project\Resources.Designer.vb">
82+
<AutoGen>True</AutoGen>
83+
<DesignTime>True</DesignTime>
84+
<DependentUpon>Resources.resx</DependentUpon>
85+
</Compile>
86+
<Compile Include="My Project\Settings.Designer.vb">
87+
<AutoGen>True</AutoGen>
88+
<DependentUpon>Settings.settings</DependentUpon>
89+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
90+
</Compile>
91+
</ItemGroup>
92+
<ItemGroup>
93+
<EmbeddedResource Include="My Project\Resources.resx">
94+
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
95+
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
96+
<CustomToolNamespace>My.Resources</CustomToolNamespace>
97+
<SubType>Designer</SubType>
98+
</EmbeddedResource>
99+
</ItemGroup>
100+
<ItemGroup>
101+
<None Include="My Project\Application.myapp">
102+
<Generator>MyApplicationCodeGenerator</Generator>
103+
<LastGenOutput>Application.Designer.vb</LastGenOutput>
104+
</None>
105+
<None Include="My Project\Settings.settings">
106+
<Generator>SettingsSingleFileGenerator</Generator>
107+
<CustomToolNamespace>My</CustomToolNamespace>
108+
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
109+
</None>
110+
<None Include="project.json" />
111+
</ItemGroup>
112+
<ItemGroup>
113+
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
114+
</ItemGroup>
115+
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
116+
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
117+
Other similar extension points exist, see Microsoft.Common.targets.
118+
<Target Name="BeforeBuild">
119+
</Target>
120+
<Target Name="AfterBuild">
121+
</Target>
122+
-->
123+
</Project>

Moq.VisualBasicTests/My Project/Application.Designer.vb

+13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3+
<MySubMain>false</MySubMain>
4+
<SingleInstance>false</SingleInstance>
5+
<ShutdownMode>0</ShutdownMode>
6+
<EnableVisualStyles>true</EnableVisualStyles>
7+
<AuthenticationMode>0</AuthenticationMode>
8+
<ApplicationType>1</ApplicationType>
9+
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
10+
</MyApplicationData>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Imports System
2+
Imports System.Reflection
3+
Imports System.Runtime.InteropServices
4+
5+
' General Information about an assembly is controlled through the following
6+
' set of attributes. Change these attribute values to modify the information
7+
' associated with an assembly.
8+
9+
' Review the values of the assembly attributes
10+
11+
<Assembly: AssemblyTitle("TestMoqUnitTests")>
12+
<Assembly: AssemblyDescription("")>
13+
<Assembly: AssemblyCompany("")>
14+
<Assembly: AssemblyProduct("TestMoqUnitTests")>
15+
<Assembly: AssemblyCopyright("Copyright © 2016")>
16+
<Assembly: AssemblyTrademark("")>
17+
18+
<Assembly: ComVisible(False)>
19+
20+
'The following GUID is for the ID of the typelib if this project is exposed to COM
21+
<Assembly: Guid("729d044b-389c-487f-96fc-03cb21821b81")>
22+
23+
' Version information for an assembly consists of the following four values:
24+
'
25+
' Major Version
26+
' Minor Version
27+
' Build Number
28+
' Revision
29+
'
30+
' You can specify all the values or you can default the Build and Revision Numbers
31+
' by using the '*' as shown below:
32+
' <Assembly: AssemblyVersion("1.0.*")>
33+
34+
<Assembly: AssemblyVersion("1.0.0.0")>
35+
<Assembly: AssemblyFileVersion("1.0.0.0")>

Moq.VisualBasicTests/My Project/Resources.Designer.vb

+63
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<root>
3+
<!--
4+
Microsoft ResX Schema
5+
6+
Version 2.0
7+
8+
The primary goals of this format is to allow a simple XML format
9+
that is mostly human readable. The generation and parsing of the
10+
various data types are done through the TypeConverter classes
11+
associated with the data types.
12+
13+
Example:
14+
15+
... ado.net/XML headers & schema ...
16+
<resheader name="resmimetype">text/microsoft-resx</resheader>
17+
<resheader name="version">2.0</resheader>
18+
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19+
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20+
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21+
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22+
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23+
<value>[base64 mime encoded serialized .NET Framework object]</value>
24+
</data>
25+
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26+
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27+
<comment>This is a comment</comment>
28+
</data>
29+
30+
There are any number of "resheader" rows that contain simple
31+
name/value pairs.
32+
33+
Each data row contains a name, and value. The row also contains a
34+
type or mimetype. Type corresponds to a .NET class that support
35+
text/value conversion through the TypeConverter architecture.
36+
Classes that don't support this are serialized and stored with the
37+
mimetype set.
38+
39+
The mimetype is used for serialized objects, and tells the
40+
ResXResourceReader how to depersist the object. This is currently not
41+
extensible. For a given mimetype the value must be set accordingly:
42+
43+
Note - application/x-microsoft.net.object.binary.base64 is the format
44+
that the ResXResourceWriter will generate, however the reader can
45+
read any of the formats listed below.
46+
47+
mimetype: application/x-microsoft.net.object.binary.base64
48+
value : The object must be serialized with
49+
: System.Serialization.Formatters.Binary.BinaryFormatter
50+
: and then encoded with base64 encoding.
51+
52+
mimetype: application/x-microsoft.net.object.soap.base64
53+
value : The object must be serialized with
54+
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55+
: and then encoded with base64 encoding.
56+
57+
mimetype: application/x-microsoft.net.object.bytearray.base64
58+
value : The object must be serialized into a byte array
59+
: using a System.ComponentModel.TypeConverter
60+
: and then encoded with base64 encoding.
61+
-->
62+
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63+
<xsd:element name="root" msdata:IsDataSet="true">
64+
<xsd:complexType>
65+
<xsd:choice maxOccurs="unbounded">
66+
<xsd:element name="metadata">
67+
<xsd:complexType>
68+
<xsd:sequence>
69+
<xsd:element name="value" type="xsd:string" minOccurs="0" />
70+
</xsd:sequence>
71+
<xsd:attribute name="name" type="xsd:string" />
72+
<xsd:attribute name="type" type="xsd:string" />
73+
<xsd:attribute name="mimetype" type="xsd:string" />
74+
</xsd:complexType>
75+
</xsd:element>
76+
<xsd:element name="assembly">
77+
<xsd:complexType>
78+
<xsd:attribute name="alias" type="xsd:string" />
79+
<xsd:attribute name="name" type="xsd:string" />
80+
</xsd:complexType>
81+
</xsd:element>
82+
<xsd:element name="data">
83+
<xsd:complexType>
84+
<xsd:sequence>
85+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
86+
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
87+
</xsd:sequence>
88+
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
89+
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
90+
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
91+
</xsd:complexType>
92+
</xsd:element>
93+
<xsd:element name="resheader">
94+
<xsd:complexType>
95+
<xsd:sequence>
96+
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
97+
</xsd:sequence>
98+
<xsd:attribute name="name" type="xsd:string" use="required" />
99+
</xsd:complexType>
100+
</xsd:element>
101+
</xsd:choice>
102+
</xsd:complexType>
103+
</xsd:element>
104+
</xsd:schema>
105+
<resheader name="resmimetype">
106+
<value>text/microsoft-resx</value>
107+
</resheader>
108+
<resheader name="version">
109+
<value>2.0</value>
110+
</resheader>
111+
<resheader name="reader">
112+
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
113+
</resheader>
114+
<resheader name="writer">
115+
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116+
</resheader>
117+
</root>

0 commit comments

Comments
 (0)