コード例 #1
0
        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);
        }
コード例 #2
0
        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"));
        }
コード例 #3
0
        /// <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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 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;
 }
コード例 #6
0
        public async Task DisposeAsync()
        {
            await VariantTest.DisposeAsync();

            await ProductTest.DisposeAsync();

            await FulfillmentServiceServTest.DisposeAsync();
        }
コード例 #7
0
 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());
 }
コード例 #8
0
 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());
 }
コード例 #9
0
        /// <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);
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        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);
        }
コード例 #13
0
        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;
        }
コード例 #14
0
 public ReadBarcode(ProductTest product)
 {
     InitializeComponent();
     ProductTest    = product;
     BindingContext = Startup.ServiceProvider.GetService <ProductItemDetailViewModel>();
 }
コード例 #15
0
ファイル: IOCTests.cs プロジェクト: laocat2004/study
        public void MethodInjectTest()
        {
            var productController = ProductTest.MethodInject();

            Assert.IsNotNull(productController);
        }
コード例 #16
0
ファイル: IOCTests.cs プロジェクト: laocat2004/study
        public void PropertyInjectTest()
        {
            var productService = ProductTest.PropertyInject();

            Assert.IsNotNull(productService);
        }
コード例 #17
0
ファイル: IOCTests.cs プロジェクト: laocat2004/study
        public void ConstructInjectTest()
        {
            var productService = ProductTest.ConstructInject();

            Assert.IsNotNull(productService);
        }
コード例 #18
0
 static void Main(string[] args)
 {
     ProductTest.Test();
 }