public async Task GetMasterProductsTest() { var controller = new MasterProductController(); var outputResult = await controller.GetMasterProducts(); var Result = outputResult.Result; var data = Result.TryGetPropertyValue <List <MasterProduct> >("Value"); Type type = typeof(List <MasterProduct>); Assert.IsInstanceOfType(data, type); }
public async Task GetMasterProductByIdTest() { int id = 1; var controller = new MasterProductController(); var outputResult = await controller.GetMasterProduct(id); var Result = outputResult.Result; var data = Result.TryGetPropertyValue <MasterProduct>("Value"); Type type = typeof(MasterProduct); Assert.IsInstanceOfType(data, type); }
public async Task PostMasterProductTest() { var controller = new MasterProductController(); var masterProduct = new MasterProduct() { ProductName = "Moto X4", Quantity = 20, Price = 14000, Availablity = true, Status = true, EntryBy = 1, EntryDate = DateTime.Now }; var outputResult = await controller.PostMasterProduct(masterProduct); var result = outputResult.Result; var data = result.TryGetPropertyValue <bool>("isInsert"); Type type = typeof(bool); Assert.IsNotNull(data); }
public async Task PutMasterProductTest() { var controller = new MasterProductController(); int pkid = 1; var masterProduct = new MasterProduct() { ProductId = 1, ProductName = "IPhone series", Quantity = 1, Price = 80000, Availablity = true, Status = true, EntryBy = 1, EntryDate = DateTime.Now }; var outputResult = await controller.PutMasterProduct(pkid, masterProduct); var result = outputResult.Result; var data = result.TryGetPropertyValue <bool>("isUpdate"); Type type = typeof(bool); Assert.IsNotNull(data); }