Esempio n. 1
0
        public void CalculateTest()
        {
            // 從整合測試的test case,來當做單元測試的test case

            // arrange
            HsinChu target = new HsinChu()
            {
                ShipProduct = new Product
                {
                    IsNeedCool = true,
                    Name       = "商品測試1",
                    Size       = new Size
                    {
                        Height = 10,
                        Length = 30,
                        Width  = 20
                    },
                    Weight = 10
                }
            };

            // act
            target.Calculate();

            var expectedName = "新竹貨運";
            var expectedFee  = 254.16;

            var actualName = target.GetsComapanyName();
            var actualFee  = target.GetsFee();

            // assert
            Assert.AreEqual(expectedName, actualName);
            Assert.AreEqual(expectedFee, actualFee);
        }
Esempio n. 2
0
        public void GetsComapanyNameTest()
        {
            HsinChu target   = new HsinChu();
            string  expected = "新竹貨運";
            string  actual;

            actual = target.GetsComapanyName();
            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void GetsFeeTest()
        {
            HsinChu target   = new HsinChu();
            double  expected = 0F;
            double  actual;

            actual = target.GetsFee();
            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
0
        public void GetILogisticsTest_Get新竹貨運()
        {
            // arrange
            string     p        = "2";
            Product    product  = new Product();
            ILogistics expected = new HsinChu();

            ILogistics actual;

            // act
            actual = SimpleFactory.GetILogistics(p, product);

            // assert
            Assert.AreEqual(expected.GetType(), actual.GetType());
        }