Пример #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 ApiEventStatusRequestModel();

            createModel.SetProperties("B");
            CreateResponse <ApiEventStatusResponseModel> createResult = await client.EventStatusCreateAsync(createModel);

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

            ApiEventStatusResponseModel getResponse = await client.EventStatusGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.EventStatusDeleteAsync(2);

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

            ApiEventStatusResponseModel verifyResponse = await client.EventStatusGetAsync(2);

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

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

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

            model.SetProperties("B");
            CreateResponse <ApiEventStatusResponseModel> result = await client.EventStatusCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
        public void MapRequestToResponse()
        {
            var mapper = new ApiEventStatusModelMapper();
            var model  = new ApiEventStatusRequestModel();

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

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiEventStatusModelMapper();
            var model  = new ApiEventStatusRequestModel();

            model.SetProperties("A");

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

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