Exemple #1
0
        private GarmentCorrectionNoteDataUtil dataUtil(GarmentCorrectionNoteFacade facade, string testName)
        {
            HttpResponseMessage httpResponseMessage = new HttpResponseMessage(HttpStatusCode.OK);

            httpResponseMessage.Content = new StringContent("{\"apiVersion\":\"1.0\",\"statusCode\":200,\"message\":\"Ok\",\"data\":[{\"Id\":7,\"code\":\"USD\",\"rate\":13700.0,\"date\":\"2018/10/20\"}],\"info\":{\"count\":1,\"page\":1,\"size\":1,\"total\":2,\"order\":{\"date\":\"desc\"},\"select\":[\"Id\",\"code\",\"rate\",\"date\"]}}");

            var httpClientService = new Mock <IHttpClientService>();

            httpClientService
            .Setup(x => x.GetAsync(It.IsAny <string>()))
            .ReturnsAsync(httpResponseMessage);

            var serviceProviderMock = new Mock <IServiceProvider>();

            serviceProviderMock
            .Setup(x => x.GetService(typeof(IHttpClientService)))
            .Returns(httpClientService.Object);

            ServiceProvider = serviceProviderMock.Object;

            var garmentPurchaseRequestFacade   = new GarmentPurchaseRequestFacade(_dbContext(testName));
            var garmentPurchaseRequestDataUtil = new GarmentPurchaseRequestDataUtil(garmentPurchaseRequestFacade);

            var garmentInternalPurchaseOrderFacade   = new GarmentInternalPurchaseOrderFacade(_dbContext(testName));
            var garmentInternalPurchaseOrderDataUtil = new GarmentInternalPurchaseOrderDataUtil(garmentInternalPurchaseOrderFacade, garmentPurchaseRequestDataUtil);

            var garmentExternalPurchaseOrderFacade   = new GarmentExternalPurchaseOrderFacade(ServiceProvider, _dbContext(testName));
            var garmentExternalPurchaseOrderDataUtil = new GarmentExternalPurchaseOrderDataUtil(garmentExternalPurchaseOrderFacade, garmentInternalPurchaseOrderDataUtil);

            var garmentDeliveryOrderFacade   = new GarmentDeliveryOrderFacade(ServiceProvider, _dbContext(testName));
            var garmentDeliveryOrderDataUtil = new GarmentDeliveryOrderDataUtil(garmentDeliveryOrderFacade, garmentExternalPurchaseOrderDataUtil);

            return(new GarmentCorrectionNoteDataUtil(facade, garmentDeliveryOrderDataUtil));
        }
Exemple #2
0
        public async void Should_Success_Create_Data()
        {
            var facade   = new GarmentCorrectionNoteFacade(_dbContext(GetCurrentMethod()));
            var data     = dataUtil(facade, GetCurrentMethod()).GetNewData().GarmentCorrectionNote;
            var Response = await facade.Create(data, USERNAME);

            Assert.NotEqual(Response, 0);
        }
Exemple #3
0
        public async void Should_Success_Get_All_Data_Koreksi_Harga_Satuan()
        {
            var facade = new GarmentCorrectionNoteFacade(_dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestDataKoreksiHargaSatuan(USERNAME);

            var Response = facade.Read();

            Assert.NotEqual(Response.Item1.Count, 0);
        }
Exemple #4
0
        public async void Should_Success_Get_Data_By_Id_Koreksi_Harga_Total()
        {
            var facade = new GarmentCorrectionNoteFacade(_dbContext(GetCurrentMethod()));
            var data   = await dataUtil(facade, GetCurrentMethod()).GetTestDataKoreksiHargaTotal(USERNAME);

            var Response = facade.ReadById((int)data.Id);

            Assert.NotEqual(Response.Id, 0);
        }
Exemple #5
0
        public async void Should_Error_Create_Data_Null_Items()
        {
            var facade = new GarmentCorrectionNoteFacade(_dbContext(GetCurrentMethod()));
            var data   = dataUtil(facade, GetCurrentMethod()).GetNewData().GarmentCorrectionNote;

            data.Items = null;
            Exception e = await Assert.ThrowsAsync <Exception>(async() => await facade.Create(data, USERNAME));

            Assert.NotNull(e.Message);
        }
        public async Task Should_Success_Get_Data()
        {
            var facade    = new GarmentCorrectionNoteFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var facadeQty = new GarmentCorrectionNoteQuantityFacade(GetServiceProvider().Object, _dbContext(GetCurrentMethod()));
            var data      = await dataUtil(facadeQty, GetCurrentMethod()).GetTestData(USERNAME);

            var Response = facade.Read();

            Assert.NotEmpty(Response.Item1);
        }
Exemple #7
0
 public GarmentCorrectionNoteDataUtil(GarmentCorrectionNoteFacade garmentCorrectionNoteFacade, GarmentDeliveryOrderDataUtil garmentDeliveryOrderDataUtil)
 {
     this.garmentCorrectionNoteFacade  = garmentCorrectionNoteFacade;
     this.garmentDeliveryOrderDataUtil = garmentDeliveryOrderDataUtil;
 }