Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Rebaseline tests
  • Loading branch information
MattKotsenas committed Jun 1, 2024
commit 0be4588904fb5ecb11b498da7d99add30b7a37fb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Diagnostic 1
Id: Moq1300
Location: SourceFile(Test0.cs[1369..1384))
Location: SourceFile(Test0.cs[1366..1381))
Highlight: BaseSampleClass
Lines: mock.As<BaseSampleClass>();
Severity: Error
Message: Mock.As() should take interfaces only

Diagnostic 2
Id: Moq1300
Location: SourceFile(Test0.cs[1534..1544))
Location: SourceFile(Test0.cs[1531..1541))
Highlight: OtherClass
Lines: mock.As<OtherClass>();
Severity: Error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
Diagnostic 1
Id: Moq1100
Location: SourceFile(Test0.cs[1090..1097))
Location: SourceFile(Test0.cs[1079..1086))
Highlight: (int i)
Lines: mock.Setup(x => x.Do(It.IsAny<string>())).Callback((int i) => { });
Severity: Warning
Message: Callback signature must match the signature of the mocked method.

Diagnostic 2
Id: Moq1100
Location: SourceFile(Test0.cs[1170..1192))
Location: SourceFile(Test0.cs[1159..1181))
Highlight: (string s1, string s2)
Lines: mock.Setup(x => x.Do(It.IsAny<string>())).Callback((string s1, string s2) => { });
Severity: Warning
Message: Callback signature must match the signature of the mocked method.

Diagnostic 3
Id: Moq1100
Location: SourceFile(Test0.cs[1304..1323))
Location: SourceFile(Test0.cs[1293..1312))
Highlight: (string s1, int i1)
Lines: mock.Setup(x => x.Do(It.IsAny<int>(), It.IsAny<string>(), It.IsAny<DateTime>())).Callback((string s1, int i1) => { });
Severity: Warning
Message: Callback signature must match the signature of the mocked method.

Diagnostic 4
Id: Moq1100
Location: SourceFile(Test0.cs[1402..1409))
Location: SourceFile(Test0.cs[1391..1398))
Highlight: (int i)
Lines: mock.Setup(x => x.Do(It.IsAny<List<string>>())).Callback((int i) => { });
Severity: Warning
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#pragma warning disable SA1402 // File may only contain a single class
using System;
using System.Collections.Generic;
using Moq;

#pragma warning disable SA1402 // File may only contain a single class
#pragma warning disable SA1502 // Element must not be on a single line
#pragma warning disable SA1602 // Undocumented enum values
#pragma warning disable SA1649 // File name must match first type name
Expand All @@ -10,10 +14,6 @@
#pragma warning disable IDE0060 // Unused parameter
namespace CallbackSignatureShouldMatchMockedMethod
{
using System;
using System.Collections.Generic;
using Moq;

internal interface IFoo
{
int Do(string s);
Expand Down Expand Up @@ -66,4 +66,4 @@ namespace CallbackSignatureShouldMatchMockedMethod
mock.Setup(x => x.Do(It.IsAny<List<string>>())).Returns((List<string> l) => { return 0; });
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
Diagnostic 1
Id: Moq1002
Location: SourceFile(Test0.cs[1227..1236))
Location: SourceFile(Test0.cs[1216..1225))
Highlight: (1, true)
Lines: var mock1 = new Moq.Mock<Foo>(1, true);
Severity: Warning
Message: Parameters provided into mock do not match any existing constructors.

Diagnostic 2
Id: Moq1002
Location: SourceFile(Test0.cs[1307..1316))
Location: SourceFile(Test0.cs[1296..1305))
Highlight: (2, true)
Lines: var mock2 = new Mock<ConstructorArgumentsShouldMatch.Foo>(2, true);
Severity: Warning
Message: Parameters provided into mock do not match any existing constructors.

Diagnostic 3
Id: Moq1002
Location: SourceFile(Test0.cs[1387..1395))
Location: SourceFile(Test0.cs[1376..1384))
Highlight: ("1", 3)
Lines: var mock3 = new Mock<ConstructorArgumentsShouldMatch.Foo>("1", 3);
Severity: Warning
Message: Parameters provided into mock do not match any existing constructors.

Diagnostic 4
Id: Moq1002
Location: SourceFile(Test0.cs[1466..1489))
Location: SourceFile(Test0.cs[1455..1478))
Highlight: (new int[] { 1, 2, 3 })
Lines: var mock4 = new Mock<ConstructorArgumentsShouldMatch.Foo>(new int[] { 1, 2, 3 });
Severity: Warning
Message: Parameters provided into mock do not match any existing constructors.

Diagnostic 5
Id: Moq1002
Location: SourceFile(Test0.cs[1581..1611))
Location: SourceFile(Test0.cs[1570..1600))
Highlight: (MockBehavior.Strict, 4, true)
Lines: var mock1 = new Mock<Foo>(MockBehavior.Strict, 4, true);
Severity: Warning
Message: Parameters provided into mock do not match any existing constructors.

Diagnostic 6
Id: Moq1002
Location: SourceFile(Test0.cs[1686..1715))
Location: SourceFile(Test0.cs[1675..1704))
Highlight: (MockBehavior.Loose, 5, true)
Lines: var mock2 = new Moq.Mock<ConstructorArgumentsShouldMatch.Foo>(MockBehavior.Loose, 5, true);
Severity: Warning
Message: Parameters provided into mock do not match any existing constructors.

Diagnostic 7
Id: Moq1002
Location: SourceFile(Test0.cs[1790..1818))
Location: SourceFile(Test0.cs[1779..1807))
Highlight: (MockBehavior.Loose, "2", 6)
Lines: var mock3 = new Moq.Mock<ConstructorArgumentsShouldMatch.Foo>(MockBehavior.Loose, "2", 6);
Severity: Warning
Expand Down
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
Diagnostic 1
Id: Moq1001
Location: SourceFile(Test0.cs[834..844))
Location: SourceFile(Test0.cs[831..841))
Highlight: (25, true)
Lines: var mock1 = new Moq.Mock<IMyService>(25, true);
Severity: Warning
Message: Mocked interfaces cannot have constructor parameters.

Diagnostic 2
Id: Moq1001
Location: SourceFile(Test0.cs[890..897))
Location: SourceFile(Test0.cs[887..894))
Highlight: ("123")
Lines: var mock2 = new Mock<IMyService>("123");
Severity: Warning
Message: Mocked interfaces cannot have constructor parameters.

Diagnostic 3
Id: Moq1001
Location: SourceFile(Test0.cs[984..994))
Location: SourceFile(Test0.cs[981..991))
Highlight: (25, true)
Lines: var mock3 = new Mock<NoConstructorArgumentsForInterfaceMock_1.IMyService>(25, true);
Severity: Warning
Message: Mocked interfaces cannot have constructor parameters.

Diagnostic 4
Id: Moq1001
Location: SourceFile(Test0.cs[1085..1092))
Location: SourceFile(Test0.cs[1082..1089))
Highlight: ("123")
Lines: var mock4 = new Moq.Mock<NoConstructorArgumentsForInterfaceMock_1.IMyService>("123");
Severity: Warning
Message: Mocked interfaces cannot have constructor parameters.

Diagnostic 5
Id: Moq1001
Location: SourceFile(Test0.cs[1195..1228))
Location: SourceFile(Test0.cs[1192..1225))
Highlight: (Moq.MockBehavior.Default, "123")
Lines: var mock1 = new Moq.Mock<IMyService>(Moq.MockBehavior.Default, "123");
Severity: Warning
Message: Mocked interfaces cannot have constructor parameters.

Diagnostic 6
Id: Moq1001
Location: SourceFile(Test0.cs[1274..1305))
Location: SourceFile(Test0.cs[1271..1302))
Highlight: (MockBehavior.Strict, 25, true)
Lines: var mock2 = new Mock<IMyService>(MockBehavior.Strict, 25, true);
Severity: Warning
Message: Mocked interfaces cannot have constructor parameters.

Diagnostic 7
Id: Moq1001
Location: SourceFile(Test0.cs[1392..1425))
Location: SourceFile(Test0.cs[1389..1422))
Highlight: (Moq.MockBehavior.Default, "123")
Lines: var mock3 = new Mock<NoConstructorArgumentsForInterfaceMock_1.IMyService>(Moq.MockBehavior.Default, "123");
Severity: Warning
Message: Mocked interfaces cannot have constructor parameters.

Diagnostic 8
Id: Moq1001
Location: SourceFile(Test0.cs[1516..1546))
Location: SourceFile(Test0.cs[1513..1543))
Highlight: (MockBehavior.Loose, 25, true)
Lines: var mock4 = new Moq.Mock<NoConstructorArgumentsForInterfaceMock_1.IMyService>(MockBehavior.Loose, 25, true);
Severity: Warning
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Diagnostic 1
Id: Moq1101
Location: SourceFile(Test0.cs[928..938))
Location: SourceFile(Test0.cs[925..935))
Highlight: x.Method()
Lines: mock.SetupGet(x => x.Method());
Severity: Warning
Message: SetupGet/SetupSet should be used for properties, not for methods.

Diagnostic 2
Id: Moq1101
Location: SourceFile(Test0.cs[972..982))
Location: SourceFile(Test0.cs[969..979))
Highlight: x.Method()
Lines: mock.SetupSet(x => x.Method());
Severity: Warning
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
Diagnostic 1
Id: Moq1000
Location: SourceFile(Test0.cs[829..838))
Location: SourceFile(Test0.cs[822..831))
Highlight: FooSealed
Lines: var mock1 = new Moq.Mock<FooSealed>();
Severity: Warning
Message: Sealed classes cannot be mocked.

Diagnostic 2
Id: Moq1000
Location: SourceFile(Test0.cs[876..885))
Location: SourceFile(Test0.cs[869..878))
Highlight: FooSealed
Lines: var mock2 = new Mock<FooSealed>();
Severity: Warning
Message: Sealed classes cannot be mocked.

Diagnostic 3
Id: Moq1000
Location: SourceFile(Test0.cs[923..951))
Location: SourceFile(Test0.cs[916..944))
Highlight: NoSealedClassMocks.FooSealed
Lines: var mock3 = new Mock<NoSealedClassMocks.FooSealed>();
Severity: Warning
Message: Sealed classes cannot be mocked.

Diagnostic 4
Id: Moq1000
Location: SourceFile(Test0.cs[993..1021))
Location: SourceFile(Test0.cs[986..1014))
Highlight: NoSealedClassMocks.FooSealed
Lines: var mock4 = new Moq.Mock<NoSealedClassMocks.FooSealed>();
Severity: Warning
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
Diagnostic 1
Id: Moq1200
Location: SourceFile(Test0.cs[2064..2077))
Location: SourceFile(Test0.cs[2060..2073))
Highlight: x.Calculate()
Lines: mock.Setup(x => x.Calculate());
Severity: Error
Message: Setup should be used only for overridable members.

Diagnostic 2
Id: Moq1200
Location: SourceFile(Test0.cs[2228..2290))
Location: SourceFile(Test0.cs[2224..2286))
Highlight: x.Calculate(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>())
Lines: mock.Setup(x => x.Calculate(It.IsAny<int>(), It.IsAny<int>(), It.IsAny<int>()));
Severity: Error
Message: Setup should be used only for overridable members.

Diagnostic 3
Id: Moq1200
Location: SourceFile(Test0.cs[2447..2457))
Location: SourceFile(Test0.cs[2443..2453))
Highlight: x.Property
Lines: mock.Setup(x => x.Property);
Severity: Error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Diagnostic 1
Id: Moq1201
Location: SourceFile(Test0.cs[845..886))
Location: SourceFile(Test0.cs[838..879))
Highlight: c.GenericAsyncWithConcreteReturn().Result
Lines: mock.Setup(c => c.GenericAsyncWithConcreteReturn().Result);
Severity: Error
Expand Down