コード例 #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 ApiPetRequestModel();

            createModel.SetProperties(1, 1, "B", 2);
            CreateResponse <ApiPetResponseModel> createResult = await client.PetCreateAsync(createModel);

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

            ApiPetResponseModel getResponse = await client.PetGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.PetDeleteAsync(2);

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

            ApiPetResponseModel verifyResponse = await client.PetGetAsync(2);

            verifyResponse.Should().BeNull();
        }
コード例 #2
0
        private async Task <ApiPetResponseModel> CreateRecord(ApiClient client)
        {
            var model = new ApiPetRequestModel();

            model.SetProperties(1, 1, "B", 2);
            CreateResponse <ApiPetResponseModel> result = await client.PetCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
コード例 #3
0
        private async Task <ApiPetResponseModel> CreateRecord()
        {
            var model = new ApiPetRequestModel();

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

            result.Success.Should().BeTrue();
            return(result.Record);
        }
コード例 #4
0
ファイル: TestBOLPetMapper.cs プロジェクト: Vin2454/samples
        public void MapModelToBO()
        {
            var mapper = new BOLPetMapper();
            ApiPetRequestModel model = new ApiPetRequestModel();

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

            response.BreedId.Should().Be(1);
            response.ClientId.Should().Be(1);
            response.Name.Should().Be("A");
            response.Weight.Should().Be(1);
        }
コード例 #5
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiPetModelMapper();
            var model  = new ApiPetRequestModel();

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

            response.BreedId.Should().Be(1);
            response.ClientId.Should().Be(1);
            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
            response.Weight.Should().Be(1);
        }
コード例 #6
0
ファイル: TestBOLPetMapper.cs プロジェクト: Vin2454/samples
        public void MapModelToBO()
        {
            var mapper = new BOLPetMapper();
            ApiPetRequestModel model = new ApiPetRequestModel();

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

            response.AcquiredDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.BreedId.Should().Be(1);
            response.Description.Should().Be("A");
            response.PenId.Should().Be(1);
            response.Price.Should().Be(1m);
            response.SpeciesId.Should().Be(1);
        }
コード例 #7
0
        public void CreatePatch()
        {
            var mapper = new ApiPetModelMapper();
            var model  = new ApiPetRequestModel();

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

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

            patch.ApplyTo(response);
            response.BreedId.Should().Be(1);
            response.ClientId.Should().Be(1);
            response.Name.Should().Be("A");
            response.Weight.Should().Be(1);
        }
コード例 #8
0
        public void CreatePatch()
        {
            var mapper = new ApiPetModelMapper();
            var model  = new ApiPetRequestModel();

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

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

            patch.ApplyTo(response);
            response.AcquiredDate.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.BreedId.Should().Be(1);
            response.Description.Should().Be("A");
            response.PenId.Should().Be(1);
            response.Price.Should().Be(1m);
            response.SpeciesId.Should().Be(1);
        }