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

            createModel.SetProperties("B", "B", 1, "B", "B", "B", "B", 1, "B");
            CreateResponse <ApiVenueResponseModel> createResult = await client.VenueCreateAsync(createModel);

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

            ApiVenueResponseModel getResponse = await client.VenueGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.VenueDeleteAsync(2);

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

            ApiVenueResponseModel verifyResponse = await client.VenueGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Пример #2
0
        private async Task <ApiVenueResponseModel> CreateRecord()
        {
            var model = new ApiVenueRequestModel();

            model.SetProperties("B", "B", 1, "B", "B", "B", "B", 1, "B");
            CreateResponse <ApiVenueResponseModel> result = await this.Client.VenueCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Пример #3
0
        public void MapModelToBO()
        {
            var mapper = new BOLVenueMapper();
            ApiVenueRequestModel model = new ApiVenueRequestModel();

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

            response.Address1.Should().Be("A");
            response.Address2.Should().Be("A");
            response.AdminId.Should().Be(1);
            response.Email.Should().Be("A");
            response.Facebook.Should().Be("A");
            response.Name.Should().Be("A");
            response.Phone.Should().Be("A");
            response.ProvinceId.Should().Be(1);
            response.Website.Should().Be("A");
        }
Пример #4
0
        public void CreatePatch()
        {
            var mapper = new ApiVenueModelMapper();
            var model  = new ApiVenueRequestModel();

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

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

            patch.ApplyTo(response);
            response.Address1.Should().Be("A");
            response.Address2.Should().Be("A");
            response.AdminId.Should().Be(1);
            response.Email.Should().Be("A");
            response.Facebook.Should().Be("A");
            response.Name.Should().Be("A");
            response.Phone.Should().Be("A");
            response.ProvinceId.Should().Be(1);
            response.Website.Should().Be("A");
        }