public void CanRaiseProblemWhenALocalStubIsUsedAsAMock() { // Arrange IList<CustomInstruction> setupMethodInstructions = GetListOfCustomInstructionForSetupMethod(); IList<CustomInstruction> instructionsForMethod = GetInstructionsForCanRaiseProblemWhenALocalStubIsUsedAsAMock(); var helper = new Helpers.DoNotConfuseRhinoMocksStubsWithMocks(); const string testMethodBeingAnalyzed = "TestMethodWhereALocalStubIsInvokedWithVerifyAllExpectations"; // Act IList<CustomProblem> problemsFound = helper. CheckIfRhinoMocksVerifyAllExpectationsIsInvokedOnALocalThatIsAStub( testMethodBeingAnalyzed, setupMethodInstructions, instructionsForMethod); // Assert const int expectedNumberOfProblemsFound = 1; const string expectedResolutionNameInXmlMetadataFile = "VerifyAllOnStub"; const string expectedLocalNameArgument = "localStub"; // The local that has the problem. Assert.That(problemsFound.Count, Is.EqualTo(expectedNumberOfProblemsFound)); Assert.That(problemsFound[0].ResolutionName, Is.EqualTo(expectedResolutionNameInXmlMetadataFile)); Assert.That(problemsFound[0].ResolutionArguments.Length, Is.EqualTo(2)); Assert.That(problemsFound[0].ResolutionArguments[0], Is.EqualTo(testMethodBeingAnalyzed)); Assert.That(problemsFound[0].ResolutionArguments[1], Is.EqualTo(expectedLocalNameArgument)); }
public void CanRaiseProblemWhenALocalStubIsUsedAsAMock() { // Arrange IList <CustomInstruction> setupMethodInstructions = GetListOfCustomInstructionForSetupMethod(); IList <CustomInstruction> instructionsForMethod = GetInstructionsForCanRaiseProblemWhenALocalStubIsUsedAsAMock(); var helper = new Helpers.DoNotConfuseRhinoMocksStubsWithMocks(); const string testMethodBeingAnalyzed = "TestMethodWhereALocalStubIsInvokedWithVerifyAllExpectations"; // Act IList <CustomProblem> problemsFound = helper. CheckIfRhinoMocksVerifyAllExpectationsIsInvokedOnALocalThatIsAStub( testMethodBeingAnalyzed, setupMethodInstructions, instructionsForMethod); // Assert const int expectedNumberOfProblemsFound = 1; const string expectedResolutionNameInXmlMetadataFile = "VerifyAllOnStub"; const string expectedLocalNameArgument = "localStub"; // The local that has the problem. Assert.That(problemsFound.Count, Is.EqualTo(expectedNumberOfProblemsFound)); Assert.That(problemsFound[0].ResolutionName, Is.EqualTo(expectedResolutionNameInXmlMetadataFile)); Assert.That(problemsFound[0].ResolutionArguments.Length, Is.EqualTo(2)); Assert.That(problemsFound[0].ResolutionArguments[0], Is.EqualTo(testMethodBeingAnalyzed)); Assert.That(problemsFound[0].ResolutionArguments[1], Is.EqualTo(expectedLocalNameArgument)); }