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

            createModel.SetProperties("B");
            CreateResponse <ApiTeacherSkillResponseModel> createResult = await client.TeacherSkillCreateAsync(createModel);

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

            ApiTeacherSkillResponseModel getResponse = await client.TeacherSkillGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.TeacherSkillDeleteAsync(2);

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

            ApiTeacherSkillResponseModel verifyResponse = await client.TeacherSkillGetAsync(2);

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

            model.SetProperties("B");
            CreateResponse <ApiTeacherSkillResponseModel> result = await client.TeacherSkillCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
        public void MapRequestToResponse()
        {
            var mapper = new ApiTeacherSkillModelMapper();
            var model = new ApiTeacherSkillRequestModel();
            model.SetProperties("A");
            ApiTeacherSkillResponseModel response = mapper.MapRequestToResponse(1, model);

            response.Id.Should().Be(1);
            response.Name.Should().Be("A");
        }
Пример #4
0
        public void MapModelToBO()
        {
            var mapper = new BOLTeacherSkillMapper();
            ApiTeacherSkillRequestModel model = new ApiTeacherSkillRequestModel();

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

            response.Name.Should().Be("A");
        }
        public void CreatePatch()
        {
            var mapper = new ApiTeacherSkillModelMapper();
            var model = new ApiTeacherSkillRequestModel();
            model.SetProperties("A");

            JsonPatchDocument<ApiTeacherSkillRequestModel> patch = mapper.CreatePatch(model);
            var response = new ApiTeacherSkillRequestModel();
            patch.ApplyTo(response);
            response.Name.Should().Be("A");
        }