public void AssociateXML() { Scenario scn = new Scenario("Test"); scn.InstallMarkup("Basic()\r\n{\r\nX\r\nY\r\nPROD(\"Result\")\r\n{\r\nPROD = X * Y\r\n}\r\n}"); scn.AssociateGivensFromXML("<Givens><Basic.X>5</Basic.X><Basic.Y>5</Basic.Y></Givens>"); Assert.AreEqual(5, scn.Givens.Find(t => t.Key == "Basic.X").Value); Assert.AreEqual(5, scn.Givens.Find(t => t.Key == "Basic.Y").Value); }
public void IndirectionTest() { Scenario testScenario = new Scenario("IndirectionTest"); TestData data = unpack.GetTestData("IndirectionTest"); testScenario.InstallMarkup(data.Markup); testScenario.AssociateGivensFromXML(data.XML); Assert.AreEqual(25, testScenario.CalculateDerivative("Other.FOO")); }
public void ExceptionIfDerivativeNotFound() { Scenario testScenario = new Scenario("X Times Y"); TestData data = unpack.GetTestData("BasicXTimesY"); testScenario.InstallMarkup(data.Markup); testScenario.AssociateGivensFromXML(data.XML); testScenario.CalculateDerivative("Foo.PROD"); }
public void BasicXTimesY() { Scenario testScenario = new Scenario("X Times Y"); TestData data = unpack.GetTestData("BasicXTimesY"); testScenario.InstallMarkup(data.Markup); testScenario.AssociateGivensFromXML(data.XML); Assert.AreEqual(25, testScenario.CalculateDerivative("Basic.PROD")); }
public void BasicXTimesYIsSelfDescribing() { Scenario testScenario = new Scenario("X Times Y"); testScenario.InstallMarkup("Basic()\r\n{\r\nX\r\nY\r\nPROD(\"whose result is found by\")\r\n{\r\nPROD = X * Y\r\n}\r\n}"); testScenario.AssociateGivensFromXML("<Givens><Basic.X>5</Basic.X><Basic.Y>5</Basic.Y></Givens>"); string description = ""; testScenario.CalculateDerivative("Basic.PROD", out description); Assert.AreEqual("Basic contains a PROD, whose result is found by the multiplication of the given Basic.X (5) and the given Basic.Y (5) yielding a value of 25", description); }
public void BasicXDividedByYIsSelfDescribing() { Scenario testScenario = new Scenario("X / Y"); testScenario.InstallMarkup("Basic()\r\n{\r\nX\r\nY\r\nPROD(\"whose result is found by\")\r\n{\r\nPROD = X \\ Y\r\n}\r\n}"); testScenario.AssociateGivensFromXML("<Givens><Basic.X>10</Basic.X><Basic.Y>2</Basic.Y></Givens>"); string description = ""; testScenario.CalculateDerivative("Basic.PROD", out description); Assert.AreEqual("Basic contains a PROD, whose result is found by the division of the given Basic.X (10) by the given Basic.Y (2) yielding a value of 5", description); }
public void IndirectionIsSelfDescribing() { Scenario testScenario = new Scenario("IndirectionTest"); TestData data = unpack.GetTestData("IndirectionTest"); testScenario.InstallMarkup(data.Markup); testScenario.AssociateGivensFromXML(data.XML); string description = ""; testScenario.CalculateDerivative("Other.FOO", out description); throw new TestIncompleteException(); }
public void TestGivenReferenceInSeperateElement() { Scenario testScenario = new Scenario("X Times Y"); testScenario.InstallMarkup("Far()\r\n{\r\nX\r\n}\r\nBasic()\r\n{\r\nY\r\nPROD(\"whose result is found by\")\r\n{\r\nPROD = Far.X * Y\r\n}\r\n}"); testScenario.AssociateGivensFromXML("<Givens><Far.X>5</Far.X><Basic.Y>5</Basic.Y></Givens>"); Assert.AreEqual(25, testScenario.CalculateDerivative("Basic.PROD")); }