Exemplo 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 ApiTagRequestModel();

            createModel.SetProperties(2, 2, "B", 2);
            CreateResponse <ApiTagResponseModel> createResult = await client.TagCreateAsync(createModel);

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

            ApiTagResponseModel getResponse = await client.TagGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.TagDeleteAsync(2);

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

            ApiTagResponseModel verifyResponse = await client.TagGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Exemplo 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());
            ApiTagResponseModel response = await client.TagGetAsync(1);

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

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <Tag>(null));
            var service = new TagService(mock.LoggerMock.Object,
                                         mock.RepositoryMock.Object,
                                         mock.ModelValidatorMockFactory.TagModelValidatorMock.Object,
                                         mock.BOLMapperMockFactory.BOLTagMapperMock,
                                         mock.DALMapperMockFactory.DALTagMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }