public async Task ProductDomainServiceTests_ImportProduct_Success() { _ = await RunWithTelemetryAsync( totalOfExecutions : 1, runInParallel : false, handler : async execution => { #region Arrange var result = false; var product = new ProductTest(null).CreateDefaultImportProduct(true); var productDomainService = ServiceProvider.GetService <IProductDomainService>(); #endregion #region Act result = await productDomainService.ImportProductAsync(product) != null; #endregion #region Assert return(result); #endregion } ).ConfigureAwait(false); }
public IActionResult InsertProductConfirm(InsertProductTestViewModel model) { ProductTest product = new ProductTest() { Name = model.Name, Count = model.Count, Price = model.Price }; product.Images = new List <ProductImageTest>(); model.images.ForEach(x => { if (x != null) { byte[] pic = new byte[x.Length]; x.OpenReadStream().Read(pic, 0, pic.Length); var image = new ProductImageTest() { Img = pic }; product.Images.Add(image); } }); db.Add(product); db.SaveChanges(); TempData["msg"] = $"کالای {model.Name} به تعداد {model.Count} به سایت اضافه شد"; return(RedirectToAction("InsertProduct", "Test")); }
/// <summary> /// Shallow copy. /// </summary> public ProductTest ConvertFromArchived(ArchivedProductTest aproductTest) { var productTest = new ProductTest(); productTest.Test = new Test(); productTest.Test.Name = aproductTest.TestName; productTest.Test.UnitName = aproductTest.TestUnitName; productTest.TestMethod = new TestMethod() { Id = Guid.NewGuid(), Method = aproductTest.TestMethods }; productTest.Test.AcredetationLevel = new AcredetationLevel(); productTest.Test.AcredetationLevel.Level = aproductTest.TestAcredetationLevel; productTest.Test.Temperature = aproductTest.TestTemperature; productTest.Test.TestCategory = new TestCategory(); productTest.Test.TestCategory.Name = aproductTest.TestCategory; productTest.Test.TestType = new TestType() { Id = Guid.NewGuid(), Type = aproductTest.TestType, ShortName = aproductTest.TestTypeShortName }; productTest.Product = new Product(); //not using converter because RECURSION productTest.Product.Number = aproductTest.ArchivedProduct.Number; productTest.Product.Name = aproductTest.ArchivedProduct.Name; productTest.Product.Quantity = aproductTest.ArchivedProduct.Quantity; return(productTest); }
public ProductTest GetItem(string id) { var response = HttpClient.GetStringAsync("https://api.upcitemdb.com/prod/trial/lookup?upc=" + id); ProductTest deserializeObject = JsonConvert.DeserializeObject <ProductTest>(response.Result); return(deserializeObject); }
public TestsReferenceW(ProductTest test) { this.TestName = test.Test.Name; this.ProductName = test.Product.Name; this.ProductQuantity = test.Product.Quantity; this.ClientName = test.Product.Diary.Client.Name; }
public async Task DisposeAsync() { await VariantTest.DisposeAsync(); await ProductTest.DisposeAsync(); await FulfillmentServiceServTest.DisposeAsync(); }
public void GetPhotoURLTest() { FillDatabaseObjects(); Assert.Equal("/images/Henk.png", EmployeeTest.GetPhotoURL()); Assert.Equal("/Img/uknownC.png", ProductTest.GetPhotoURL()); Assert.Equal("/Img/uknownA.img", RecipeTest.GetPhotoURL()); Assert.Equal("/Img/uknownA.img", NewsTest.GetPhotoURL()); }
public void GetContentTest() { FillDatabaseObjects(); Assert.Equal("Sleeping", EmployeeTest.GetContent()); Assert.Equal("SaltChicken very small", ProductTest.GetContent()); Assert.Equal("ChickenEgg", RecipeTest.GetContent()); Assert.Equal("Mad", NewsTest.GetContent()); }
/// <summary> /// Shallow copy. /// </summary> public ArchivedProductTest ConvertToArchived(ProductTest productTest) { var archivedProductTest = new ArchivedProductTest(); archivedProductTest.TestName = productTest.Test.Name; archivedProductTest.TestUnitName = productTest.Test.UnitName; archivedProductTest.TestMethods = productTest.TestMethod.Method; archivedProductTest.TestAcredetationLevel = productTest.Test.AcredetationLevel.Level; archivedProductTest.TestTemperature = productTest.Test.Temperature; archivedProductTest.TestCategory = productTest.Test.TestCategory.Name; return(archivedProductTest); }
public async Task InitializeAsync() { // Get a product id to use with these tests. var prod = await ProductTest.Create(); VariantTest.ProductId = prod.Id.Value; var variant = prod.Variants.First(); InventoryItemId = variant.InventoryItemId.Value; variant.SKU = "TestSKU"; //To change fulfillment, SKU is required variant.InventoryManagement = "Shopify"; //To set inventory, InventoryManagement must be Shopify await VariantTest.Service.UpdateAsync(variant.Id.Value, variant); }
public void Test1() { //Arrange ProductTest objectProductTest = new ProductTest(); //Act List <ProductInfo> result1 = objectProductTest.testDisplayAll(); IEnumerable <ProductInfo> result2 = objectProductTest.testSort(); int num1 = result1.Count; //Assert Assert.IsType <List <ProductInfo> >(result1); Assert.IsType <List <ProductInfo> >(result2); Assert.Equal(9, num1); }
public async Task InitializeAsync() { Service.SetExecutionPolicy(new LeakyBucketExecutionPolicy()); // Get a product id to use with these tests. var prod = await ProductTest.Create(); VariantTest.ProductId = prod.Id.Value; var variant = prod.Variants.First(); InventoryItemId = variant.InventoryItemId.Value; // Must set variant.InventoryQuantity to null as it is now read-only. Sending the quantity accidentally will result in an exception. variant.InventoryQuantity = null; variant.SKU = "TestSKU"; //To change fulfillment, SKU is required variant.InventoryManagement = "Shopify"; //To set inventory, InventoryManagement must be Shopify await VariantTest.Service.UpdateAsync(variant.Id.Value, variant); }
public static IMaestroTester GetTester(string transaction) { IMaestroTester result = null; switch(transaction) { case "ORDER": result = new OrderTest(); break; case "CUSTOMER": result = new CustomerTest(); break; case "PRODUCT": result = new ProductTest(); break; case "UNIT": result = new UnitTest(); break; case "UNIT_TYPE": result = new UnitTypeTest(); break; case "TRAN_DEFINITION": result = new TranDefTest(); break; case "REGION": result = new RegionTest(); break; case "CUSTOMER_PRODUCT_UNIT": result = new CustomerProductUnitTest(); break; case "QUICKBOOKS_INVOICE": result = new QbInvoiceTest(); break; } return result; }
public ReadBarcode(ProductTest product) { InitializeComponent(); ProductTest = product; BindingContext = Startup.ServiceProvider.GetService <ProductItemDetailViewModel>(); }
public void MethodInjectTest() { var productController = ProductTest.MethodInject(); Assert.IsNotNull(productController); }
public void PropertyInjectTest() { var productService = ProductTest.PropertyInject(); Assert.IsNotNull(productService); }
public void ConstructInjectTest() { var productService = ProductTest.ConstructInject(); Assert.IsNotNull(productService); }
static void Main(string[] args) { ProductTest.Test(); }