Esempio n. 1
0
        public async Task Should_Success_Update_Created_Data()
        {
            var serviceProviderMock = GetServiceProvider();
            var dbContext           = GetDbContext(GetCurrentMethod());

            var service = new GarmentInvoicePurchasingDispositionService(serviceProviderMock.Object, dbContext);

            var expedition = new GarmentDispositionExpeditionModel();

            EntityExtension.FlagForCreate(expedition, "Test", "Test");
            dbContext.GarmentDispositionExpeditions.Add(expedition);
            dbContext.SaveChanges();

            var model = new GarmentInvoicePurchasingDispositionModel()
            {
                InvoiceNo = "Test", SupplierName = "Test", CurrencyCode = "Code", BankName = "BankName", Items = new List <GarmentInvoicePurchasingDispositionItemModel>()
                {
                    new GarmentInvoicePurchasingDispositionItemModel(0, expedition.Id, "Test")
                }
            };
            await service.CreateAsync(model);

            var result = await service.UpdateAsync(model.Id, model);

            Assert.NotEqual(0, result);
        }
Esempio n. 2
0
        public async Task Should_Success_Post_Data()
        {
            var serviceProviderMock = GetServiceProvider();
            var dbContext           = GetDbContext(GetCurrentMethod());

            var service = new GarmentInvoicePurchasingDispositionService(serviceProviderMock.Object, dbContext);

            var expedition = new GarmentDispositionExpeditionModel();

            EntityExtension.FlagForCreate(expedition, "Test", "Test");
            dbContext.GarmentDispositionExpeditions.Add(expedition);
            dbContext.SaveChanges();

            var model = new GarmentInvoicePurchasingDispositionPostingViewModel()
            {
                ListIds = new List <GarmentInvoicePurchasingDispositionPostingIdViewModel>()
                {
                    new GarmentInvoicePurchasingDispositionPostingIdViewModel()
                    {
                        Id = 1
                    }
                }
            };

            var result = await service.Post(model);

            Assert.Equal(0, result);
        }
Esempio n. 3
0
        public async Task Should_Not_Empty_Read_Created_Data()
        {
            var serviceProviderMock = GetServiceProvider();
            var dbContext           = GetDbContext(GetCurrentMethod());

            var service = new GarmentInvoicePurchasingDispositionService(serviceProviderMock.Object, dbContext);

            var expedition = new GarmentDispositionExpeditionModel();

            EntityExtension.FlagForCreate(expedition, "Test", "Test");
            dbContext.GarmentDispositionExpeditions.Add(expedition);
            dbContext.SaveChanges();

            await service.CreateAsync(new GarmentInvoicePurchasingDispositionModel()
            {
                InvoiceNo = "Test", SupplierName = "Test", CurrencyCode = "Code", BankName = "BankName", Items = new List <GarmentInvoicePurchasingDispositionItemModel>()
                {
                    new GarmentInvoicePurchasingDispositionItemModel(0, expedition.Id, "Test")
                }
            });

            var result = service.Read(1, 10, "{}", new List <string>(), null, "{}");

            Assert.NotEmpty(result.Data);
        }
Esempio n. 4
0
        public void Should_Success_getLoader()
        {
            var serviceProviderMock = GetServiceProvider();
            var dbContext           = GetDbContext(GetCurrentMethod());

            var service = new GarmentInvoicePurchasingDispositionService(serviceProviderMock.Object, dbContext);

            var model = new GarmentInvoicePurchasingDispositionModel()
            {
                InvoiceDate = DateTimeOffset.Now, InvoiceNo = "Test", SupplierName = "Test", CurrencyCode = "Code", BankName = "BankName", Items = new List <GarmentInvoicePurchasingDispositionItemModel>()
                {
                    new GarmentInvoicePurchasingDispositionItemModel(0, 1, "Test")
                }
            };

            EntityExtension.FlagForCreate(model, "Test", "Test");
            dbContext.GarmentInvoicePurchasingDispositions.Add(model);
            dbContext.SaveChanges();
        }
Esempio n. 5
0
        public void Should_Success_getMonitoringNullDate()
        {
            var serviceProviderMock = GetServiceProvider();
            var dbContext           = GetDbContext(GetCurrentMethod());

            var service = new GarmentInvoicePurchasingDispositionService(serviceProviderMock.Object, dbContext);

            var model = new GarmentInvoicePurchasingDispositionModel()
            {
                InvoiceDate = DateTimeOffset.Now, InvoiceNo = "Test", SupplierName = "Test", CurrencyCode = "Code", BankName = "BankName", Items = new List <GarmentInvoicePurchasingDispositionItemModel>()
                {
                    new GarmentInvoicePurchasingDispositionItemModel(0, 1, "Test")
                }
            };
            var model1 = new GarmentInvoicePurchasingDispositionModel()
            {
                InvoiceDate = DateTimeOffset.Now, InvoiceNo = "Test", SupplierName = "Test", CurrencyCode = "Code", BankName = "BankName", Items = new List <GarmentInvoicePurchasingDispositionItemModel>()
                {
                    new GarmentInvoicePurchasingDispositionItemModel(0, 1, "Test")
                }
            };
            var model2 = new GarmentInvoicePurchasingDispositionModel()
            {
                InvoiceDate = DateTimeOffset.Now, InvoiceNo = "Test", SupplierName = "Test", CurrencyCode = "Code", BankName = "BankName", Items = new List <GarmentInvoicePurchasingDispositionItemModel>()
                {
                    new GarmentInvoicePurchasingDispositionItemModel(0, 1, "Test1")
                }
            };

            EntityExtension.FlagForCreate(model, "Test", "Test");
            dbContext.GarmentInvoicePurchasingDispositions.Add(model);
            EntityExtension.FlagForCreate(model1, "Test", "Test");
            dbContext.GarmentInvoicePurchasingDispositions.Add(model1);
            EntityExtension.FlagForCreate(model2, "Test", "Test");
            dbContext.GarmentInvoicePurchasingDispositions.Add(model2);
            dbContext.SaveChanges();


            var result = service.GetMonitoring(null, null, Convert.ToDateTime("0001-01-01 00:00:00.0000000 +00:00"), Convert.ToDateTime("0001-01-01 00:00:00.0000000 +00:00"), 7);

            Assert.NotNull(result);
        }