コード例 #1
0
        public void GetTransactionTest()
        {
            var actualResult = new TransactionOrder
            {
                TransactionType = "Sales",
                DateTransaction = DateTime.Now,
                RefNo           = "TestRef"
            };

            actualResult = TransactionOrder.CreateTransaction(actualResult);

            var expectedResult = TransactionOrder.GetTransaction(actualResult.Id);

            UnitTestingHelper.AssertPublicPropertiesEqual(actualResult, expectedResult);

            if (TransactionOrder.GetTransaction("DoesNotExist") != null)
            {
                Assert.Fail("Transaction Order should not exist and must return null");
            }

            if (TransactionOrder.GetTransaction(actualResult.Id + " ") != null)
            {
                Assert.Fail("Transaction Order must return null since the id is modified");
            }

            TransactionOrder.DeleteTransaction(actualResult.Id);
        }
コード例 #2
0
        public void CreateProductTest()
        {
            var actualResult = new Product {
                Name = "CreateProductTest"
            };

            Product.CreateProduct(actualResult);
            var expectedResult = Product.GetProduct(actualResult.Id);

            UnitTestingHelper.AssertPublicPropertiesEqual(actualResult, expectedResult);
            Product.DeleteProduct(actualResult.Id);
        }
コード例 #3
0
        public void CreateTransactionTest()
        {
            var actualResult = new TransactionOrder
            {
                TransactionType = "Sales",
                DateTransaction = DateTime.Now,
                RefNo           = "TestRef"
            };

            actualResult = TransactionOrder.CreateTransaction(actualResult);
            var expectedResult = TransactionOrder.GetTransaction(actualResult.Id);

            UnitTestingHelper.AssertPublicPropertiesEqual(actualResult, expectedResult);
            TransactionOrder.DeleteTransaction(actualResult.Id);
        }
コード例 #4
0
        public void GetProductTest()
        {
            var actualResult = new Product {
                Name = "GetProductTest"
            };

            Product.CreateProduct(actualResult);
            var expectedResult = Product.GetProduct(actualResult.Id);

            UnitTestingHelper.AssertPublicPropertiesEqual(actualResult, expectedResult);

            if (Product.GetProduct("DoesNotExist") != null)
            {
                Assert.Fail("Product should not exist and must return null");
            }

            if (Product.GetProduct(actualResult.Id + " ") != null)
            {
                Assert.Fail("Product must return null since the id is modified");
            }

            Product.DeleteProduct(actualResult.Id);
        }