public void Price_ConstructorTest2() { // Arrange Price p = new Price(price1, CurrencyInfoCollection.GetCurrencyInfo("GBP")); // Act // Assert Assert.AreEqual(p.Value, 936.5m); Assert.AreEqual(p.CurrencyInfo, cigbp); Assert.AreSame(p.CurrencyInfo, cigbp); }
public void CurrencyInfoCollection_TestGetCurrencyInfo() { // Arrange CurrencyInfo ci; // Act ci = CurrencyInfoCollection.GetCurrencyInfo("USD"); // Assert Assert.IsNotNull(ci); Assert.AreEqual(ci.ISO, "USD"); Assert.IsTrue(ci.DecimalPlaces != 0); }
public void Price_OperatorOverloadTest() { //Arrange CurrencyInfo cigbp = CurrencyInfoCollection.GetCurrencyInfo("GBP"); Price p1 = new Price(new decimal(4), cigbp); Price p2 = new Price(new decimal(3), cigbp); Price p3 = p1 + p2; Price p4 = p1 - p2; //Act //Assert Assert.IsTrue(new Price(new decimal(7), cigbp) == p3); Assert.IsTrue(new Price(new decimal(1), cigbp) == p4); Assert.IsTrue(new Price(new decimal(4), cigbp) == p1); Assert.IsTrue(new Price(new decimal(5), cigbp) != p1); Assert.IsTrue(new Price(new decimal(6), cigbp) > p1); Assert.IsTrue(new Price(new decimal(3), cigbp) < p1); Assert.IsTrue(new Price(new decimal(4), cigbp) >= p1); Assert.IsTrue(new Price(new decimal(3), cigbp) <= p1); }