Beispiel #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 ApiVersionInfoRequestModel();

            createModel.SetProperties(DateTime.Parse("1/1/1988 12:00:00 AM"), "B");
            CreateResponse <ApiVersionInfoResponseModel> createResult = await client.VersionInfoCreateAsync(createModel);

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

            ApiVersionInfoResponseModel getResponse = await client.VersionInfoGetAsync(2);

            getResponse.Should().NotBeNull();

            ActionResponse deleteResult = await client.VersionInfoDeleteAsync(2);

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

            ApiVersionInfoResponseModel verifyResponse = await client.VersionInfoGetAsync(2);

            verifyResponse.Should().BeNull();
        }
Beispiel #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());
            ApiVersionInfoResponseModel response = await client.VersionInfoGetAsync(1);

            response.Should().NotBeNull();
        }
Beispiel #3
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IVersionInfoRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <long>())).Returns(Task.FromResult <VersionInfo>(null));
            var service = new VersionInfoService(mock.LoggerMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.VersionInfoModelValidatorMock.Object,
                                                 mock.BOLMapperMockFactory.BOLVersionInfoMapperMock,
                                                 mock.DALMapperMockFactory.DALVersionInfoMapperMock);

            ApiVersionInfoResponseModel response = await service.Get(default(long));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <long>()));
        }
Beispiel #4
0
        public async void TestGet()
        {
            ApiVersionInfoResponseModel response = await this.Client.VersionInfoGetAsync(1);

            response.Should().NotBeNull();
        }