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 ApiSpaceRequestModel();

            createModel.SetProperties("B", "B");
            CreateResponse <ApiSpaceResponseModel> createResult = await client.SpaceCreateAsync(createModel);

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

            ApiSpaceResponseModel getResponse = await client.SpaceGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.SpaceDeleteAsync(2);

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

            ApiSpaceResponseModel verifyResponse = await client.SpaceGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Exemple #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());
            ApiSpaceResponseModel response = await client.SpaceGetAsync(1);

            response.Should().NotBeNull();
        }
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <ISpaceRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Space>(null));
            var service = new SpaceService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.SpaceModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLSpaceMapperMock,
                                           mock.DALMapperMockFactory.DALSpaceMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
        public async void TestGet()
        {
            ApiSpaceResponseModel response = await this.Client.SpaceGetAsync(1);

            response.Should().NotBeNull();
        }