public void ToDouble_IsCalled_ADoubleTypeShouldBeReturned() { //Arrange var unit = new AreaUnit(10, Areas.Cm2); Type expectedType = typeof(double); //Act double toDouble = unit.ToDouble(Areas.M2); //Assert Assert.IsInstanceOfType(toDouble, expectedType); }
public void CastToDouble_Returns_DoubleOfCurrentUserUnitValue() { //Arrange var unit = new AreaUnit(10, Areas.In2); const double expectedValue = 10; //Act double actualDouble = Convert.ToDouble(unit); //Assert Assert.AreEqual(expectedValue, actualDouble); }
public void Unit_MultipliedByAnotherUnit_EqualsAreaMultiplied() { //Arrange var unit1 = new AreaUnit(30, Areas.In2); var unit2 = new AreaUnit(10, Areas.In2); const double expectedValue = 300; //Act double actualValue = (unit1 * unit2).SystemValue; //Assert Assert.AreEqual(expectedValue, actualValue); }
public void Unit_DividedFromAnotherArea_EqualsTheDividedValue() { //Arrange var unit1 = new AreaUnit(30, Areas.In2); var unit2 = new AreaUnit(2, Areas.In2); const double expectedValue = 15; //Act double actualValue = (unit1 / unit2).SystemValue; //Assert Assert.AreEqual(expectedValue, actualValue); }
public void Unit_AddedToAnotherUnit_EqualsTheSumOfAreas() { //Arrange var unit1 = new AreaUnit(10, Areas.In2); var unit2 = new AreaUnit(10, Areas.In2); const double expectedValue = 20; //Act double actualValue = (unit1 + unit2).SystemValue; //Assert Assert.AreEqual(expectedValue, actualValue); }
public void Unit_SubtractedFromAnotherUnit_EqualsTheDifferenceOfAreas() { //Arrange var unit1 = new AreaUnit(30, Areas.In2); var unit2 = new AreaUnit(10, Areas.In2); const double expectedValue = 20; //Act double actualValue = (unit1 - unit2).SystemValue; //Assert Assert.AreEqual(expectedValue, actualValue); }
public void Unit_ToStringIsCalled_UnitValuesAndItsSymbolReturnedAsAString() { //Arrange var unit = new AreaUnit(5, Areas.In2); const string expectedValue = "5.0 in²"; //Act string actualValue = unit.ToString(); //Assert Assert.AreEqual(expectedValue, actualValue); }