Ejemplo 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 ApiTeamRequestModel();

            createModel.SetProperties("B", 1);
            CreateResponse <ApiTeamResponseModel> createResult = await client.TeamCreateAsync(createModel);

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

            ApiTeamResponseModel getResponse = await client.TeamGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.TeamDeleteAsync(2);

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

            ApiTeamResponseModel verifyResponse = await client.TeamGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Ejemplo n.º 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());
            ApiTeamResponseModel response = await client.TeamGetAsync(1);

            response.Should().NotBeNull();
        }
Ejemplo n.º 3
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <ITeamRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult <Team>(null));
            var service = new TeamService(mock.LoggerMock.Object,
                                          mock.RepositoryMock.Object,
                                          mock.ModelValidatorMockFactory.TeamModelValidatorMock.Object,
                                          mock.BOLMapperMockFactory.BOLTeamMapperMock,
                                          mock.DALMapperMockFactory.DALTeamMapperMock);

            ApiTeamResponseModel response = await service.Get(default(string));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>()));
        }
Ejemplo n.º 4
0
        public async void Get()
        {
            var mock   = new ServiceMockFacade <ITeamRepository>();
            var record = new Team();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult(record));
            var service = new TeamService(mock.LoggerMock.Object,
                                          mock.RepositoryMock.Object,
                                          mock.ModelValidatorMockFactory.TeamModelValidatorMock.Object,
                                          mock.BOLMapperMockFactory.BOLTeamMapperMock,
                                          mock.DALMapperMockFactory.DALTeamMapperMock,
                                          mock.BOLMapperMockFactory.BOLChainMapperMock,
                                          mock.DALMapperMockFactory.DALChainMapperMock);

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

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Ejemplo n.º 5
0
        public async void TestGet()
        {
            ApiTeamResponseModel response = await this.Client.TeamGetAsync(1);

            response.Should().NotBeNull();
        }