public void HandleViolation_ProblemMetadataGivenButNoViolation_NoProblemAdded() { var expectedFragment = Fragment.CreateNamed(c_expectedType); var givenFragment = Fragment.CreateNamed(c_expectedType); IPreCondition preCondition = new CustomInferencePreCondition(c_symbol, expectedFragment, _problemMetadata); var context = new SymbolTable(_blacklistManager); context.MakeSafe(c_symbol, givenFragment); IProblemPipe problemPipe = MockRepository.GenerateMock <IProblemPipe>(); preCondition.HandleViolation(context, problemPipe); problemPipe.AssertWasNotCalled(pipe => pipe.AddProblem(Arg <ProblemMetadata> .Is.Anything)); }
public void HandleViolation_ViolationNotProvoked_KeepsSymbolFragment() { var expectedFragment = Fragment.CreateNamed(c_expectedType); var givenFragment = expectedFragment; IPreCondition preCondition = new CustomInferencePreCondition(c_symbol, expectedFragment, _problemMetadata); var context = new SymbolTable(_blacklistManager); context.MakeSafe(c_symbol, givenFragment); IProblemPipe problemPipe = MockRepository.GenerateMock <IProblemPipe>(); preCondition.HandleViolation(context, problemPipe); bool symbolFragmentKept = context.GetFragmentType(c_symbol) == expectedFragment; Assert.That(symbolFragmentKept, Is.True); }