Ejemplo n.º 1
0
        public void GivenOverrideOperatorPlus_WhenForFirstProductIsNullAndSecondProductIsNotNull_ThenIsTotalExeption(
            string nameSecondPencil, double doubleCostSecondPencil, string purposeSecondPencil, PencilProducts nullObject)
        {
            //Arrange
            PencilProducts firstPencil  = nullObject;
            PencilProducts secondPencil = new PencilProducts(nameSecondPencil, doubleCostSecondPencil, purposeSecondPencil);

            //Assert
            Assert.That(() => firstPencil + secondPencil, Throws.TypeOf <ArgumentNullException>());
        }
Ejemplo n.º 2
0
        public void GivenExplicitTypeOfCost_WhenDoubleCost_ThenIsIntCost(
            string name, double doubleCost, string purpose, int intExpectedCost)
        {
            //Act
            PencilProducts pencilDouble = new PencilProducts(name, doubleCost, purpose);
            //Arrange
            int intActualCostExplicit = (int)pencilDouble;

            //Asssert
            Assert.AreEqual(intExpectedCost, intActualCostExplicit);
        }
Ejemplo n.º 3
0
        public void GivenOverrideOperatorPlus_WhenForFirstProductIsAndSecondProductIs_ThenIsTotalSumm(
            string nameFirstPencil, double doubleCostFirstPencil, string purposeFirstPencil,
            string nameSecondPencil, double doubleCostSecondPencil, string purposeSecondPencil,
            string nameExpectedPencil, double doubleCostExpectedPencil, string purposeExpectedPencil)
        {
            //Act
            PencilProducts firstPencil    = new PencilProducts(nameFirstPencil, doubleCostFirstPencil, purposeFirstPencil);
            PencilProducts secondPencil   = new PencilProducts(nameSecondPencil, doubleCostSecondPencil, purposeSecondPencil);
            PencilProducts expectedPencil = new PencilProducts(nameExpectedPencil, doubleCostExpectedPencil, purposeExpectedPencil);
            //Arrange
            PencilProducts actualPencil = firstPencil + secondPencil;

            //Asssert
            Assert.AreEqual(expectedPencil, actualPencil);
        }