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); }
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); }
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); }
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); }