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

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

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

            ApiTeacherResponseModel getResponse = await client.TeacherGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.TeacherDeleteAsync(2);

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

            ApiTeacherResponseModel verifyResponse = await client.TeacherGetAsync(2);

            verifyResponse.Should().BeNull();
        }
コード例 #2
0
        public async void TestGet()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());
            ApiTeacherResponseModel response = await client.TeacherGetAsync(1);

            response.Should().NotBeNull();
        }
コード例 #3
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <ITeacherRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Teacher>(null));
            var service = new TeacherService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.TeacherModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLTeacherMapperMock,
                                             mock.DALMapperMockFactory.DALTeacherMapperMock,
                                             mock.BOLMapperMockFactory.BOLRateMapperMock,
                                             mock.DALMapperMockFactory.DALRateMapperMock);

            ApiTeacherResponseModel response = await service.Get(default(int));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
コード例 #4
0
        public async void TestGet()
        {
            ApiTeacherResponseModel response = await this.Client.TeacherGetAsync(1);

            response.Should().NotBeNull();
        }