public void MyFractionTest_CreatesMyFractionObject() { MyFraction mf = new MyFraction(); string expectedResult = "EgyptianFractions.MyFraction"; string actualResult = mf.GetType().FullName.ToString(); Assert.AreEqual(expectedResult, actualResult); }
public void DecimalTypeToFractionBravo() { MyFraction mf = new MyFraction(0.9); string expectedResult = "9/10"; string actualResult = mf.ToString(); Assert.AreEqual(expectedResult, actualResult); }
public void DecimalEquivalentTest() { MyFraction mf = new MyFraction(1, 4); decimal expectedResult = 0.25m; decimal actualResult = mf.DecimalEquivalent(); Assert.AreEqual(expectedResult, actualResult); }
public void DecimalTypeToFractionAlpha() { MyFraction mf = new MyFraction(0.75); string expectedResult = "3/4"; string actualResult = mf.ToString(); Assert.AreEqual(expectedResult, actualResult); }
public void GetImproperFractionTest() { MyFraction mf = new MyFraction(4, 3); string expectedResult = "1 1/3"; string actualResult = mf.GetImproperFraction(); Assert.AreEqual(expectedResult, actualResult); }
public void MyFractionTest_CtorDoublesBuildFraction() { MyFraction mf = new MyFraction(1, 3); string expectedResult = "1/3"; string actualResult = mf.ToString(); Assert.AreEqual(expectedResult, actualResult); }
public void Test_GreedyAlgo_Alpha() { string expectedResult = "2/1"; MyFraction f1 = new MyFraction(8, 11); MyFraction result = new MyFraction(MyEgyptianFractions.GreedyAlgo(f1.Numerator, f1.Denominator)); Console.WriteLine(result.ToString()); Assert.AreEqual(expectedResult, result.ToString()); }
public void DifferenceTest() { MyFraction mf1 = new MyFraction(1, 2); MyFraction mf2 = new MyFraction(3, 4); string expectedResult = "1/4"; MyFraction mfDiff = mf1.Difference(mf2); string actualResult = mfDiff.ToString(); Assert.AreEqual(expectedResult, actualResult); }
public void Test_FractionSplitter_Alpha() { string expectedResult = "2/11, 6/11"; MyFraction f1 = new MyFraction(8, 11); MyFraction result = new MyFraction(); MyFraction fraction2 = null; result = MyEgyptianFractions.FractionSplitter(f1, out fraction2); Console.WriteLine(result.ToString()); Assert.AreEqual(expectedResult, $"{result.ToString()}, {fraction2.ToString()}"); }
public void IsImproperTest_False() { MyFraction mf = new MyFraction(3, 4); Assert.IsFalse(mf.IsImproper()); }
public void IsImproperTest_True() { MyFraction mf = new MyFraction(4, 3); Assert.IsTrue(mf.IsImproper()); }