コード例 #1
0
        public async Task Should_Success_Delete_Data()
        {
            GarmentPurchaseRequestFacade facade = new GarmentPurchaseRequestFacade(ServiceProvider, _dbContext(GetCurrentMethod()));
            var model = await this.dataUtil(facade, GetCurrentMethod()).GetTestData();

            var Response = await facade.Delete((int)model.Id, USERNAME);

            Assert.NotEqual(Response, 0);
        }
コード例 #2
0
        public async Task Should_Success_Delete_Data_With_Update_IsPR()
        {
            var mockHttpClient = new Mock <IHttpClientService>();

            mockHttpClient
            .Setup(x => x.PatchAsync(It.IsAny <string>(), It.IsAny <HttpContent>()))
            .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK));

            var mockServiceProvider = GetServiceProvider();

            mockServiceProvider
            .Setup(x => x.GetService(typeof(IHttpClientService)))
            .Returns(mockHttpClient.Object);

            GarmentPurchaseRequestFacade facade = new GarmentPurchaseRequestFacade(mockServiceProvider.Object, _dbContext(GetCurrentMethod()));
            var model = await this.dataUtil(facade, GetCurrentMethod()).GetTestData();

            model.PRType = "MASTER";

            var Response = await facade.Delete((int)model.Id, USERNAME);

            Assert.NotEqual(Response, 0);
        }
コード例 #3
0
        public async Task Should_Error_Delete_Data()
        {
            GarmentPurchaseRequestFacade facade = new GarmentPurchaseRequestFacade(ServiceProvider, _dbContext(GetCurrentMethod()));

            Exception errorInvalidId = await Assert.ThrowsAsync <Exception>(async() => await facade.Delete(0, USERNAME));

            Assert.NotNull(errorInvalidId.Message);
        }