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 ApiLocationRequestModel();

            createModel.SetProperties(2, 2, "B");
            CreateResponse <ApiLocationResponseModel> createResult = await client.LocationCreateAsync(createModel);

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

            ApiLocationResponseModel getResponse = await client.LocationGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.LocationDeleteAsync(2);

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

            ApiLocationResponseModel verifyResponse = await client.LocationGetAsync(2);

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

            model.SetProperties(2, 2, "B");
            CreateResponse <ApiLocationResponseModel> result = await client.LocationCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Beispiel #3
0
        private async Task <ApiLocationResponseModel> CreateRecord()
        {
            var model = new ApiLocationRequestModel();

            model.SetProperties(2, 2m, DateTime.Parse("1/1/1988 12:00:00 AM"), "B");
            CreateResponse <ApiLocationResponseModel> result = await this.Client.LocationCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Beispiel #4
0
        public void MapModelToBO()
        {
            var mapper = new BOLLocationMapper();
            ApiLocationRequestModel model = new ApiLocationRequestModel();

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

            response.GpsLat.Should().Be(1);
            response.GpsLong.Should().Be(1);
            response.LocationName.Should().Be("A");
        }
Beispiel #5
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiLocationModelMapper();
            var model  = new ApiLocationRequestModel();

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

            response.GpsLat.Should().Be(1);
            response.GpsLong.Should().Be(1);
            response.LocationId.Should().Be(1);
            response.LocationName.Should().Be("A");
        }
        public void MapModelToBO()
        {
            var mapper = new BOLLocationMapper();
            ApiLocationRequestModel model = new ApiLocationRequestModel();

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

            response.Availability.Should().Be(1);
            response.CostRate.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
        }
Beispiel #7
0
        public void CreatePatch()
        {
            var mapper = new ApiLocationModelMapper();
            var model  = new ApiLocationRequestModel();

            model.SetProperties(1, 1, "A");

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

            patch.ApplyTo(response);
            response.GpsLat.Should().Be(1);
            response.GpsLong.Should().Be(1);
            response.LocationName.Should().Be("A");
        }
Beispiel #8
0
        public void CreatePatch()
        {
            var mapper = new ApiLocationModelMapper();
            var model  = new ApiLocationRequestModel();

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

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

            patch.ApplyTo(response);
            response.Availability.Should().Be(1);
            response.CostRate.Should().Be(1m);
            response.ModifiedDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Name.Should().Be("A");
        }