예제 #1
0
        public void InsertNewRecordWithEmptyFullName_ShouldError()
        {
            var newItem = new Distributor
            {
                FullName = null,
                Status   = 2
            };
            IDistributorService service = new DistributorService();
            var response = service.Add(newItem);

            Assert.IsTrue(response.Status == StatusFlag.Error);
        }
예제 #2
0
        public void InsertNewRecordWithOutrangeStatus_ShouldError()
        {
            var newItem = new Distributor
            {
                FullName = "Mikocok",
                Status   = 127
            };
            IDistributorService service = new DistributorService();
            var response = service.Add(newItem);

            Assert.IsTrue(response.Status == StatusFlag.Error);
        }
예제 #3
0
        public void AddDistributor_Valid()
        {
            //arrange
            IDistributorService service = new DistributorService();
            var distributor             = new Distributor();

            distributor.BODS_FullName = "Agung Pradnya";
            distributor.BODS_Id       = new Guid("617dba9d-391b-4ca7-aeeb-0703ca526709");
            distributor.BODS_Status   = 1;

            //Act
            var actual = service.Add(distributor);

            //Assert
            Assert.AreEqual("Agung Pradnya", actual.BODS_FullName);
        }
예제 #4
0
        public void InsertNewRecord_ShouldReturnCorrectItem()
        {
            var newItem = new Distributor
            {
                FullName = "I Putu Yoga Permana",
                Status   = 1
            };
            IDistributorService service = new DistributorService();
            var response = service.Add(newItem);
            var guid     = (Guid)response.Data;

            // Get the newly created item
            var distributorResponse = service.GetById(new List <Guid> {
                guid
            });
            var distributorCollection = (List <Distributor>)distributorResponse.Data;

            Assert.AreEqual(distributorCollection.FirstOrDefault().FullName, newItem.FullName);
            Assert.AreEqual(distributorCollection.FirstOrDefault().Status, newItem.Status);
        }
        public void CreateDatabaseSchemaTest()
        {
            ProductModel    product     = new ProductModel();
            StockLevelModel stockLevel1 = new StockLevelModel();

            stockLevel1.Amount = 10;
            stockLevel1.Products.Add(product);
            product.ProductName = "可口可乐";
            product.UnitName    = "瓶子";
            product.StockLevels.Add(stockLevel1);
            productService.Add(product);
            stockLevelService.Add(stockLevel1);

            WarehouseModel warehouse = new WarehouseModel();

            warehouse.Address = "chengdu shi";
            warehouse.StockLevels.Add(stockLevel1);
            stockLevel1.Warehouses.Add(warehouse);

            warehouseService.Add(warehouse);

            IList <string> productNames = productService.GetAllProductNames();

            Console.WriteLine(productNames);

            DistributorModel distributor = new DistributorModel();

            distributor.Name    = "黄凯";
            distributor.Address = "贵州";

            distributorService.Add(distributor);

            IList <string> distributorNames = distributorService.GetAllDistributorNames();

            Console.WriteLine(distributorNames);
        }