public async void Get_Success_Excel()
        {
            var dbContext       = DbContext(GetCurrentMethod());
            var serviceProvider = GetServiceProviderMock(dbContext).Object;

            CostCalculationGarmentFacade costCalculationGarmentFacade = new CostCalculationGarmentFacade(serviceProvider, dbContext);

            var data = await DataUtil(costCalculationGarmentFacade, serviceProvider, dbContext).GetTestData();

            var acceptedBy = "acceptedBy";
            await costCalculationGarmentFacade.AcceptanceCC(new List <long> {
                data.Id
            }, acceptedBy);

            var filter = new
            {
                section           = data.Section,
                roNo              = data.RO_Number,
                buyer             = data.BuyerBrandCode,
                acceptedDateStart = data.ROAcceptedDate.AddDays(-30),
                acceptedDateEnd   = data.ROAcceptedDate.AddDays(30),
            };

            var facade   = new AcceptedROReportFacade(serviceProvider);
            var Response = facade.GenerateExcel(filter: JsonConvert.SerializeObject(filter));

            Assert.NotNull(Response.Item2);
        }
Example #2
0
        public async void Get_Success()
        {
            var dbContext       = DbContext(GetCurrentMethod());
            var serviceProvider = GetServiceProviderMock(dbContext).Object;

            CostCalculationGarmentFacade costCalculationGarmentFacade = new CostCalculationGarmentFacade(serviceProvider, dbContext);

            var data = await DataUtil(costCalculationGarmentFacade, serviceProvider, dbContext).GetTestData();

            var AvailableBy = "AvailableBy";
            await costCalculationGarmentFacade.AcceptanceCC(new List <long> {
                data.Id
            }, AvailableBy);

            await costCalculationGarmentFacade.AvailableCC(new List <long> {
                data.Id
            }, AvailableBy);

            var filter = new
            {
                section = data.Section,
                //roNo = data.RO_Number,
                //buyer = data.BuyerBrandCode,
                availableDateStart = data.ROAvailableDate.AddDays(-30),
                availableDateEnd   = data.ROAvailableDate.AddDays(30),
                //status = "OK"
            };

            var facade   = new AvailableROReportFacade(serviceProvider);
            var Response = facade.Read(filter: JsonConvert.SerializeObject(filter));

            Assert.NotEqual(Response.Item2, 0);
        }
Example #3
0
        public async void Get_Success_Excel()
        {
            var dbContext       = DbContext(GetCurrentMethod());
            var serviceProvider = GetServiceProviderMock(dbContext).Object;

            CostCalculationGarmentFacade costCalculationGarmentFacade = new CostCalculationGarmentFacade(serviceProvider, dbContext);

            var data = await DataUtil(costCalculationGarmentFacade, serviceProvider, dbContext).GetNewData();

            await costCalculationGarmentFacade.CreateAsync(data);

            var data1 = await DataUtil(costCalculationGarmentFacade, serviceProvider, dbContext).GetNewData();

            data1.LeadTime = 35;
            await costCalculationGarmentFacade.CreateAsync(data1);

            var AvailableBy = "AvailableBy";
            await costCalculationGarmentFacade.AcceptanceCC(new List <long> {
                data.Id
            }, AvailableBy);

            await costCalculationGarmentFacade.AvailableCC(new List <long> {
                data.Id
            }, AvailableBy);

            JsonPatchDocument <CostCalculationGarment> jsonPatch = new JsonPatchDocument <CostCalculationGarment>();

            jsonPatch.Replace(m => m.IsApprovedKadivMD, true);
            jsonPatch.Replace(m => m.ApprovedKadivMDBy, "Super Man");
            jsonPatch.Replace(m => m.ApprovedKadivMDDate, DateTimeOffset.Now);
            await costCalculationGarmentFacade.Patch(data.Id, jsonPatch);

            var filter = new
            {
                section = data.Section,
                //roNo = data.RO_Number,
                //buyer = data.BuyerBrandCode,
                availableDateStart = data.DeliveryDate.AddDays(-30),
                availableDateEnd   = data.DeliveryDate.AddDays(30),
                //status = "OK"
            };

            var facade   = new AvailableROGarmentReportFacade(serviceProvider);
            var Response = facade.GenerateExcel(filter: JsonConvert.SerializeObject(filter));

            Assert.NotNull(Response.Item2);
        }
        private async void ApproveData(CostCalculationGarment data, CostCalculationGarmentFacade costCalculationGarmentFacade)
        {
            var AvailableBy = "AvailableBy";

            await costCalculationGarmentFacade.AcceptanceCC(new List <long> {
                data.Id
            }, AvailableBy);

            await costCalculationGarmentFacade.AvailableCC(new List <long> {
                data.Id
            }, AvailableBy);

            JsonPatchDocument <CostCalculationGarment> jsonPatch = new JsonPatchDocument <CostCalculationGarment>();

            jsonPatch.Replace(m => m.IsApprovedPPIC, true);
            jsonPatch.Replace(m => m.ApprovedPPICBy, "Super Man");
            jsonPatch.Replace(m => m.ApprovedPPICDate, DateTimeOffset.Now);

            await costCalculationGarmentFacade.Patch(data.Id, jsonPatch);
        }
        public async void Get_Success()
        {
            var dbContext       = DbContext(GetCurrentMethod());
            var serviceProvider = GetServiceProviderMock(dbContext).Object;

            CostCalculationGarmentFacade costCalculationGarmentFacade = new CostCalculationGarmentFacade(serviceProvider, dbContext);

            var data = await DataUtil(costCalculationGarmentFacade, serviceProvider, dbContext).GetTestData();

            var AvailableBy = "AvailableBy";
            await costCalculationGarmentFacade.AcceptanceCC(new List <long> {
                data.Id
            }, AvailableBy);

            await costCalculationGarmentFacade.AvailableCC(new List <long> {
                data.Id
            }, AvailableBy);

            JsonPatchDocument <CostCalculationGarment> jsonPatch = new JsonPatchDocument <CostCalculationGarment>();

            jsonPatch.Replace(m => m.IsApprovedPPIC, true);
            jsonPatch.Replace(m => m.ApprovedPPICBy, "Super Man");
            jsonPatch.Replace(m => m.ApprovedPPICDate, DateTimeOffset.Now);
            await costCalculationGarmentFacade.Patch(data.Id, jsonPatch);

            var filter = new
            {
                section = data.Section,
                //roNo = data.RO_Number,
                //buyer = data.BuyerBrandCode,
                availableDateStart = data.DeliveryDate,
                availableDateEnd   = data.DeliveryDate,
                //status = "NOT OK"
            };

            var facade   = new AvailableBudgetReportFacade(serviceProvider);
            var Response = facade.Read(filter: JsonConvert.SerializeObject(filter));

            Assert.NotEqual(Response.Item2, 0);
        }