Exemple #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 ApiRateRequestModel();

            createModel.SetProperties(2m, 1, 1);
            CreateResponse <ApiRateResponseModel> createResult = await client.RateCreateAsync(createModel);

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

            ApiRateResponseModel getResponse = await client.RateGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.RateDeleteAsync(2);

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

            ApiRateResponseModel verifyResponse = await client.RateGetAsync(2);

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

            model.SetProperties(2m, 1, 1);
            CreateResponse <ApiRateResponseModel> result = await client.RateCreateAsync(model);

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

            model.SetProperties(1m, 1, 1);
            BORate response = mapper.MapModelToBO(1, model);

            response.AmountPerMinute.Should().Be(1m);
            response.TeacherId.Should().Be(1);
            response.TeacherSkillId.Should().Be(1);
        }
Exemple #4
0
        public void MapRequestToResponse()
        {
            var mapper = new ApiRateModelMapper();
            var model  = new ApiRateRequestModel();

            model.SetProperties(1m, 1, 1);
            ApiRateResponseModel response = mapper.MapRequestToResponse(1, model);

            response.AmountPerMinute.Should().Be(1m);
            response.Id.Should().Be(1);
            response.TeacherId.Should().Be(1);
            response.TeacherSkillId.Should().Be(1);
        }
Exemple #5
0
        public void CreatePatch()
        {
            var mapper = new ApiRateModelMapper();
            var model  = new ApiRateRequestModel();

            model.SetProperties(1m, 1, 1);

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

            patch.ApplyTo(response);
            response.AmountPerMinute.Should().Be(1m);
            response.TeacherId.Should().Be(1);
            response.TeacherSkillId.Should().Be(1);
        }