public void GivenOverrideOperatorPlus_WhenForFirstProductIsNullAndSecondProductIsNotNull_ThenIsTotalExeption( string nameSecondPhone, double doubleCostSecondPhone, string brandSecondPhone, PhoneProducts nullObject) { //Arrange PhoneProducts firstPhone = nullObject; PhoneProducts secondPhone = new PhoneProducts(nameSecondPhone, doubleCostSecondPhone, brandSecondPhone); //Assert Assert.That(() => firstPhone + secondPhone, Throws.TypeOf <ArgumentNullException>()); }
public void GivenExplicitTypeOfCost_WhenDoubleCost_ThenIsIntCost( string name, double doubleCost, string brand, int intExpectedCost) { //Act PhoneProducts phoneDouble = new PhoneProducts(name, doubleCost, brand); //Arrange int intActualCostExplicit = (int)phoneDouble; //Asssert Assert.AreEqual(intExpectedCost, intActualCostExplicit); }
public void GivenOverrideOperatorPlus_WhenForFirstProductIsAndSecondProductIs_ThenIsTotalSumm( string nameFirstPhone, double doubleCostFirstPhone, string brandFirstPhone, string nameSecondPhone, double doubleCostSecondPhone, string brandSecondPhone, string nameExpectedPhone, double doubleCostExpectedPhone, string brandExpectedPhone) { //Act PhoneProducts firstPhone = new PhoneProducts(nameFirstPhone, doubleCostFirstPhone, brandFirstPhone); PhoneProducts secondPhone = new PhoneProducts(nameSecondPhone, doubleCostSecondPhone, brandSecondPhone); PhoneProducts expectedPhone = new PhoneProducts(nameExpectedPhone, doubleCostExpectedPhone, brandExpectedPhone); //Arrange PhoneProducts actualPhone = firstPhone + secondPhone; //Asssert Assert.AreEqual(expectedPhone, actualPhone); }