Skip to content

Commit

Permalink
More build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kzu committed Aug 3, 2023
1 parent 146f9a7 commit dee710f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
2 changes: 2 additions & 0 deletions src/Directory.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<SignAssembly>true</SignAssembly>
<PublicKey>00240000048000009400000006020000002400005253413100040000010001009f7a95086500f8f66d892174803850fed9c22225c2ccfff21f39c8af8abfa5415b1664efd0d8e0a6f7f2513b1c11659bd84723dc7900c3d481b833a73a2bcf1ed94c16c4be64d54352c86956c89930444e9ac15124d3693e3f029818e8410f167399d6b995324b635e95353ba97bfab856abbaeb9b40c9b160070c6325e22ddc</PublicKey>
<PublicKeyToken>69f491c39445e920</PublicKeyToken>

<SourceRoot>$(MSBuildThisFileDirectory)..\</SourceRoot>
</PropertyGroup>

</Project>
36 changes: 18 additions & 18 deletions src/Moq.Tests.VisualBasic/IssueReports.vb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Imports Xunit

Public Class IssueReports

Public Class Issue278
Class Issue278

<Fact()>
Public Sub SetupsForPropertiesWithMultipleArgsDoNotOverwriteEachOther()
Sub SetupsForPropertiesWithMultipleArgsDoNotOverwriteEachOther()
Dim mock As New Mock(Of ISimpleInterface)()

mock.Setup(Function(m) m.PropertyWithMultipleArgs(1, 1)).Returns(1)
Expand All @@ -19,17 +19,17 @@ Public Class IssueReports

End Sub

Public Interface ISimpleInterface
Interface ISimpleInterface

ReadOnly Property PropertyWithMultipleArgs(setting As Integer, setting2 As Integer) As Integer

End Interface
End Class

Public Class Issue1067
Class Issue1067

<Fact>
Public Sub Test_NonGeneric()
Sub Test_NonGeneric()
Dim userManagerMock = New Mock(Of IUserManager)()
Setup_NonGeneric(userManagerMock, 42)

Expand All @@ -40,7 +40,7 @@ Public Class IssueReports
End Sub

<Fact>
Public Sub Test_Generic()
Sub Test_Generic()
Dim userManagerMock = New Mock(Of IUserManager)()
Setup_Generic(Of User)(userManagerMock, 42)

Expand All @@ -50,11 +50,11 @@ Public Class IssueReports
Assert.Equal(42, user.Id)
End Sub

Public Class User
Class User
Property Id As Integer
End Class

Public Interface IUserManager
Interface IUserManager
Sub Create(User As User)
End Interface

Expand All @@ -73,52 +73,52 @@ Public Class IssueReports

End Class

Public Class Issue1129
Class Issue1129

<Fact>
Public Sub Test()
Sub Test()
Dim classMock = New Mock(Of IndexerInterface)()

classMock.SetupAllProperties()

Assert.False(classMock.Object.Value)
End Sub
Public Interface IndexerInterface
Interface IndexerInterface
ReadOnly Property SystemDefault() As Boolean
Property Value() As Boolean
Property Value(ByVal OverrideLevel As Integer) As Boolean
Property Value(ByVal OverrideLevel As Integer, ByVal OverrideID As String) As Boolean
End Interface
End Class

Public Class Issue1153
Class Issue1153

<Fact>
Public Sub Indexer_overload_can_be_distinguished_from_property_when_mocking_declaring_class()
Sub Indexer_overload_can_be_distinguished_from_property_when_mocking_declaring_class()
Dim mock = New Mock(Of MyVBClassBase)()
mock.Setup(Function(m) m.Prop).Returns(True)
End Sub

<Fact>
Public Sub Indexer_overload_can_be_distinguished_from_property_when_mocking_subclass_of_declaring_class()
Sub Indexer_overload_can_be_distinguished_from_property_when_mocking_subclass_of_declaring_class()
Dim mock = New Mock(Of MyVBClass)()
mock.Setup(Function(m) m.Prop).Returns(True)
End Sub

Public Class MyVBClassBase
Public Overridable ReadOnly Property Prop() As Boolean
Class MyVBClassBase
Overridable ReadOnly Property Prop() As Boolean
Get
Return True
End Get
End Property
Public Overridable ReadOnly Property Prop(ByVal userID As Guid) As Boolean
Overridable ReadOnly Property Prop(ByVal userID As Guid) As Boolean
Get
Return False
End Get
End Property
End Class

Public Class MyVBClass
Class MyVBClass
Inherits MyVBClassBase
End Class

Expand Down
5 changes: 1 addition & 4 deletions src/Moq/Moq.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,7 @@
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="IFluentInterface" Version="2.1.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="NuGetizer" Version="1.0.5" />
<PackageReference Include="TypeNameFormatter.Sources" Version="1.1.1" PrivateAssets="All" />
</ItemGroup>
Expand Down
3 changes: 1 addition & 2 deletions src/Moq/Protected/ProtectedMock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -458,8 +458,7 @@ static Type[] ToArgTypes(object[] args)
throw new ArgumentException(Resources.UseItExprIsNullRatherThanNullArgumentValue);
}

var expr = args[index] as Expression;
if (expr == null)
if (args[index] is not Expression expr)
{
types[index] = args[index].GetType();
}
Expand Down

0 comments on commit dee710f

Please sign in to comment.