Beispiel #1
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);
        }