public void A_Criteria_Analyze_Result_Should_Be_Negated_If_Defined() { var childA = MockRepository.GenerateMock<CriteriaBase>(); childA.Expect(x => x.Analyze(null)).Return(ResultEnumeration.@true); var target = new Modulo.Collect.OVAL.Results.CriteriaType() { @operator = OperatorEnumeration.AND }; target.negate = true; target.Items = new List<object> { childA }; var result = target.Analyze(null); Assert.AreEqual(ResultEnumeration.@false, result); }
public void A_Criteria_Analyze_Result_Should_Be_The_Combination_Of_All_Children_Criteria_Results() { var childA = MockRepository.GenerateMock<CriteriaBase>(); childA.Expect(x => x.Analyze(null)).Return(ResultEnumeration.@true); var childB = MockRepository.GenerateMock<CriteriaBase>(); childB.Expect(x => x.Analyze(null)).Return(ResultEnumeration.@false); var target = new Modulo.Collect.OVAL.Results.CriteriaType(); target.@operator = OperatorEnumeration.AND; target.Items = new List<object> { childA, childB }; var result = target.Analyze(null); Assert.AreEqual(ResultEnumeration.@false, result); }
public void A_Criteria_Analyze_Should_Evaluate_Result_Only_Once() { var childA = MockRepository.GenerateMock<CriteriaBase>(); var defaultResult = default(ResultEnumeration); childA.Expect(x => x.Analyze(null)).Return(oval_results.NegateResult(defaultResult, true)); var target = new Modulo.Collect.OVAL.Results.CriteriaType(); target.@operator = OperatorEnumeration.AND; target.Items = new List<object> { childA }; // First Call - should Evaluate Children var result = target.Analyze(null); // Second Call - Should Return Stored Result result = target.Analyze(null); Assert.AreNotEqual(defaultResult, result); }
public void A_Criteria_Analyze_Result_Should_Be_The_Combination_Of_All_Children_Criteria_Results() { var childA = MockRepository.GenerateMock <CriteriaBase>(); childA.Expect(x => x.Analyze(null)).Return(ResultEnumeration.@true); var childB = MockRepository.GenerateMock <CriteriaBase>(); childB.Expect(x => x.Analyze(null)).Return(ResultEnumeration.@false); var target = new Modulo.Collect.OVAL.Results.CriteriaType(); target.@operator = OperatorEnumeration.AND; target.Items = new List <object> { childA, childB }; var result = target.Analyze(null); Assert.AreEqual(ResultEnumeration.@false, result); }
public void A_Criteria_Analyze_Result_Should_Be_Negated_If_Defined() { var childA = MockRepository.GenerateMock <CriteriaBase>(); childA.Expect(x => x.Analyze(null)).Return(ResultEnumeration.@true); var target = new Modulo.Collect.OVAL.Results.CriteriaType() { @operator = OperatorEnumeration.AND }; target.negate = true; target.Items = new List <object> { childA }; var result = target.Analyze(null); Assert.AreEqual(ResultEnumeration.@false, result); }
public void A_Criteria_Analyze_Should_Evaluate_Result_Only_Once() { var childA = MockRepository.GenerateMock <CriteriaBase>(); var defaultResult = default(ResultEnumeration); childA.Expect(x => x.Analyze(null)).Return(oval_results.NegateResult(defaultResult, true)); var target = new Modulo.Collect.OVAL.Results.CriteriaType(); target.@operator = OperatorEnumeration.AND; target.Items = new List <object> { childA }; // First Call - should Evaluate Children var result = target.Analyze(null); // Second Call - Should Return Stored Result result = target.Analyze(null); Assert.AreNotEqual(defaultResult, result); }