Esempio n. 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 ApiStudentRequestModel();

            createModel.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), "B", true, 1, "B", true, "B", "B", true, 1);
            CreateResponse <ApiStudentResponseModel> createResult = await client.StudentCreateAsync(createModel);

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

            ApiStudentResponseModel getResponse = await client.StudentGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.StudentDeleteAsync(2);

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

            ApiStudentResponseModel verifyResponse = await client.StudentGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Esempio n. 2
0
        private async Task <ApiStudentResponseModel> CreateRecord()
        {
            var model = new ApiStudentRequestModel();

            model.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), "B", true, 1, "B", true, "B", "B", true, 1);
            CreateResponse <ApiStudentResponseModel> result = await this.Client.StudentCreateAsync(model);

            result.Success.Should().BeTrue();
            return(result.Record);
        }
Esempio n. 3
0
        public void MapModelToBO()
        {
            var mapper = new BOLStudentMapper();
            ApiStudentRequestModel model = new ApiStudentRequestModel();

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

            response.Birthday.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Email.Should().Be("A");
            response.EmailRemindersEnabled.Should().Be(true);
            response.FamilyId.Should().Be(1);
            response.FirstName.Should().Be("A");
            response.IsAdult.Should().Be(true);
            response.LastName.Should().Be("A");
            response.Phone.Should().Be("A");
            response.SmsRemindersEnabled.Should().Be(true);
            response.UserId.Should().Be(1);
        }
Esempio n. 4
0
        public void CreatePatch()
        {
            var mapper = new ApiStudentModelMapper();
            var model  = new ApiStudentRequestModel();

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

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

            patch.ApplyTo(response);
            response.Birthday.Should().Be(DateTime.Parse("1/1/1987 12:00:00 AM"));
            response.Email.Should().Be("A");
            response.EmailRemindersEnabled.Should().Be(true);
            response.FamilyId.Should().Be(1);
            response.FirstName.Should().Be("A");
            response.IsAdult.Should().Be(true);
            response.LastName.Should().Be("A");
            response.Phone.Should().Be("A");
            response.SmsRemindersEnabled.Should().Be(true);
            response.StudioId.Should().Be(1);
        }