예제 #1
0
        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>());
        }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }