Пример #1
0
        public async void TestDelete()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());

            var createModel = new ApiFileTypeRequestModel();

            createModel.SetProperties("B");
            CreateResponse <ApiFileTypeResponseModel> createResult = await client.FileTypeCreateAsync(createModel);

            createResult.Success.Should().BeTrue();

            ApiFileTypeResponseModel getResponse = await client.FileTypeGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.FileTypeDeleteAsync(2);

            deleteResult.Success.Should().BeTrue();

            ApiFileTypeResponseModel verifyResponse = await client.FileTypeGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Пример #2
0
        public void MapModelToBO()
        {
            var mapper = new BOLFileTypeMapper();
            ApiFileTypeRequestModel model = new ApiFileTypeRequestModel();

            model.SetProperties("A");
            BOFileType response = mapper.MapModelToBO(1, model);

            response.Name.Should().Be("A");
        }
Пример #3
0
        private async Task <ApiFileTypeResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiFileTypeRequestModel();

            model.SetProperties("B");
            CreateResponse <ApiFileTypeResponseModel> result = await client.FileTypeCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Пример #4
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiFileTypeModelMapper();
            var model  = new ApiFileTypeRequestModel();

            model.SetProperties("A");
            ApiFileTypeResponseModel response = mapper.MapRequestToResponse(1, model);

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
Пример #5
0
        public void CreatePatch()
        {
            var mapper = new ApiFileTypeModelMapper();
            var model  = new ApiFileTypeRequestModel();

            model.SetProperties("A");

            JsonPatchDocument <ApiFileTypeRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiFileTypeRequestModel();

            patch.ApplyTo(response);
            response.Name.Should().Be("A");
        }