Example #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 ApiRowVersionCheckRequestModel();

            createModel.SetProperties("B", Guid.Parse("3842cac4-b9a0-8223-0dcc-509a6f75849b"));
            CreateResponse <ApiRowVersionCheckResponseModel> createResult = await client.RowVersionCheckCreateAsync(createModel);

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

            ApiRowVersionCheckResponseModel getResponse = await client.RowVersionCheckGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.RowVersionCheckDeleteAsync(2);

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

            ApiRowVersionCheckResponseModel verifyResponse = await client.RowVersionCheckGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Example #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());
            ApiRowVersionCheckResponseModel response = await client.RowVersionCheckGetAsync(1);

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

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <RowVersionCheck>(null));
            var service = new RowVersionCheckService(mock.LoggerMock.Object,
                                                     mock.RepositoryMock.Object,
                                                     mock.ModelValidatorMockFactory.RowVersionCheckModelValidatorMock.Object,
                                                     mock.BOLMapperMockFactory.BOLRowVersionCheckMapperMock,
                                                     mock.DALMapperMockFactory.DALRowVersionCheckMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Example #4
0
        public async void TestGet()
        {
            ApiRowVersionCheckResponseModel response = await this.Client.RowVersionCheckGetAsync(1);

            response.Should().NotBeNull();
        }