Beispiel #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 ApiVersionInfoRequestModel();

            createModel.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), "B");
            CreateResponse <ApiVersionInfoResponseModel> createResult = await client.VersionInfoCreateAsync(createModel);

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

            ApiVersionInfoResponseModel getResponse = await client.VersionInfoGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.VersionInfoDeleteAsync(2);

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

            ApiVersionInfoResponseModel verifyResponse = await client.VersionInfoGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Beispiel #2
0
        private async Task <ApiVersionInfoResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiVersionInfoRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), "B");
            CreateResponse <ApiVersionInfoResponseModel> result = await client.VersionInfoCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
        public void MapModelToBO()
        {
            var mapper = new BOLVersionInfoMapper();
            ApiVersionInfoRequestModel model = new ApiVersionInfoRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A");
            BOVersionInfo response = mapper.MapModelToBO(1, model);

            response.AppliedOn.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Description.Should().Be("A");
        }
        public void MapRequestToResponse()
        {
            var mapper = new ApiVersionInfoModelMapper();
            var model  = new ApiVersionInfoRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A");
            ApiVersionInfoResponseModel response = mapper.MapRequestToResponse(1, model);

            response.AppliedOn.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Description.Should().Be("A");
            response.Version.Should().Be(1);
        }
        public void CreatePatch()
        {
            var mapper = new ApiVersionInfoModelMapper();
            var model  = new ApiVersionInfoRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1987 12:00:00 AM"), "A");

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

            patch.ApplyTo(response);
            response.AppliedOn.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Description.Should().Be("A");
        }