static void Main() { // Create adapter and place a request Target target = new Adapter(); target.Request(); // Wait for user Console.Read(); }
public void NormCdfTest() { new NormalDistribution(0, 1); //matlabResult = 0.682689492137086; Adaptee adaptee = new Adaptee(); Adapter target = new Adapter(adaptee); Func<double, double> expected = adaptee.NormCdf; Func<double, double> actual; actual = target.NormCdf; Assert.AreNotEqual(expected, actual, "Adaptee should be adapted.") ; Func<double, double> otherFunction = arg => { arg = arg - 1; return arg; }; Assert.AreNotEqual(expected, otherFunction); ///Assert.Inconclusive("Verify the correctness of this test method."); }
public void AdapterConstructorAdapteeTest() { Adaptee adaptee = new Adaptee(); Adapter target = new Adapter(adaptee); //Assert.IsFalse(target.Distributions is Distributions); //Assert.AreEqual(target.Distributions , new Distributions()); Func<double, double> expected = adaptee.NormCdf; Func<double, double> actual = target.NormCdf; Assert.AreNotEqual(expected(1), actual(1), "Should NOT be equal function behaviour."); Func<double, double> otherFunction = arg => { arg = arg - 1; return arg; }; Assert.AreNotEqual(expected, otherFunction); }
public void AdapterGetDistribTest() { Distributions target1 = new Distributions(); Adapter target = new Adapter(target1); ///Adaptee adaptee = new Adaptee(); Assert.AreEqual(target.NormCdf(1), target1.NormCdf(1), 1.0E-8); target = new Adapter(); Assert.AreEqual(1, target.NormCdf(1), 1.0E-8); }
public void AdapterConstructorTargetTest() { Distributions target1 = new Distributions(); Adapter target = new Adapter(target1); Adaptee adaptee = new Adaptee(); NormalDistribution normCdf = new NormalDistribution(0, 1); Func<double, double> expected = target1.NormCdf; Func<double, double> actual = target.NormCdf; Assert.AreNotEqual(expected(1), adaptee.NormCdf(1), "Should NOT be equal function behaviour."); Assert.AreEqual(expected(1), actual(1), "Should be equal function behaviour."); Assert.AreEqual( normCdf.CumulativeDistribution(1), actual(1), "Should be equal function behaviour."); Func<double, double> normCdf2 = arg => { arg = arg - 1; return arg; }; Assert.AreNotEqual(expected, normCdf2); }