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

            createModel.SetProperties("B");
            CreateResponse <ApiSpaceFeatureResponseModel> createResult = await client.SpaceFeatureCreateAsync(createModel);

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

            ApiSpaceFeatureResponseModel getResponse = await client.SpaceFeatureGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.SpaceFeatureDeleteAsync(2);

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

            ApiSpaceFeatureResponseModel verifyResponse = await client.SpaceFeatureGetAsync(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());
            ApiSpaceFeatureResponseModel response = await client.SpaceFeatureGetAsync(1);

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

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <SpaceFeature>(null));
            var service = new SpaceFeatureService(mock.LoggerMock.Object,
                                                  mock.RepositoryMock.Object,
                                                  mock.ModelValidatorMockFactory.SpaceFeatureModelValidatorMock.Object,
                                                  mock.BOLMapperMockFactory.BOLSpaceFeatureMapperMock,
                                                  mock.DALMapperMockFactory.DALSpaceFeatureMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Ejemplo n.º 4
0
        public async void TestGet()
        {
            ApiSpaceFeatureResponseModel response = await this.Client.SpaceFeatureGetAsync(1);

            response.Should().NotBeNull();
        }