public void ConsiderTest( [Range(0.0f, 10.0f, 2.5f)] float xval1, [Range(0.0f, 10.0f, 2.5f)] float xval2) { // NEVER use the derived class to call // Consider otherwise the machinery in the base // class is never called! var c = ConsiderationConstructor.Multiplicative(); var cd1 = new OptionConsideration1(); var cd2 = new OptionConsideration2(); cd1.NameId = "cd1"; cd2.NameId = "cd2"; c.AddConsideration(cd1); c.AddConsideration(cd2); _optionContext.XVal1 = xval1; _optionContext.XVal2 = xval2; cd1.Consider(_optionContext); cd2.Consider(_optionContext); var cUtil1 = cd1.Utility; var cUtil2 = cd2.Utility; var cUtilL = new List <Utility>(); cUtilL.Add(cUtil1); cUtilL.Add(cUtil2); var cNorm = cUtilL.MultiplyCombined(); c.Consider(_optionContext); Assert.That(c.Utility.Value, Is.EqualTo(cNorm).Within(Tolerance)); }
public void ConstructorTest() { var c = ConsiderationConstructor.Multiplicative(); Assert.IsNotNull(c); Assert.That(c.Weight, Is.EqualTo(1.0f).Within(Tolerance)); }
public void MultiplicativeConstructor() { var c = ConsiderationConstructor.Multiplicative(); Assert.IsNotNull(c); Assert.IsNotNull(c.Measure); Assert.That(c.Measure is MultiplicativePseudoMeasure); }
public void MultiplicativeNameConstructor() { var cc = new ConsiderationCollection(); var c = ConsiderationConstructor.Multiplicative("name", cc); Assert.IsNotNull(c); Assert.IsNotNull(c.Measure); Assert.That(c.Measure is MultiplicativePseudoMeasure); }