private void SetPreConditionForIndexerObject( AssignmentStatement assignmentStatement, string targetName, Fragment sourceFragmentType, HandleContext context) { if (targetName != null) { ProblemMetadata problemMetadata = new ProblemMetadata( assignmentStatement.UniqueKey, assignmentStatement.SourceContext, sourceFragmentType, Fragment.CreateNamed("??")); var preCondition = new EqualityPreCondition(targetName, sourceFragmentType, problemMetadata); context.PreConditions.Add(preCondition); } }
public void IsViolated_ViolatingContext_ChangesProblemMetadatasGivenType() { var expectedFragment = Fragment.CreateNamed("expectedFragment"); var unexpectedFragment = Fragment.CreateNamed("unexpectedFragment"); ProblemMetadata problemMetaData = new ProblemMetadata(0, new SourceContext(), expectedFragment, Fragment.CreateNamed("dummy")); IBlacklistManager blackListManager = _mocks.Stub <IBlacklistManager>(); EqualityPreCondition preCondition = new EqualityPreCondition("testSymbol", expectedFragment, problemMetaData); SymbolTable context = new SymbolTable(blackListManager); context.MakeSafe("testSymbol", unexpectedFragment); preCondition.IsViolated(context); Assert.That(problemMetaData.GivenFragment, Is.EqualTo(unexpectedFragment)); }