Пример #1
0
        public async void TestGet()
        {
            var builder = new WebHostBuilder()
                          .UseEnvironment("Production")
                          .UseStartup <TestStartup>();
            TestServer testServer = new TestServer(builder);

            var client = new ApiClient(testServer.CreateClient());
            ApiContactTypeResponseModel response = await client.ContactTypeGetAsync(1);

            response.Should().NotBeNull();
        }
Пример #2
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IContactTypeRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <int>())).Returns(Task.FromResult <ContactType>(null));
            var service = new ContactTypeService(mock.LoggerMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.ContactTypeModelValidatorMock.Object,
                                                 mock.BOLMapperMockFactory.BOLContactTypeMapperMock,
                                                 mock.DALMapperMockFactory.DALContactTypeMapperMock,
                                                 mock.BOLMapperMockFactory.BOLBusinessEntityContactMapperMock,
                                                 mock.DALMapperMockFactory.DALBusinessEntityContactMapperMock);

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

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <int>()));
        }
Пример #3
0
        public async void ByName_Exists()
        {
            var mock   = new ServiceMockFacade <IContactTypeRepository>();
            var record = new ContactType();

            mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult(record));
            var service = new ContactTypeService(mock.LoggerMock.Object,
                                                 mock.RepositoryMock.Object,
                                                 mock.ModelValidatorMockFactory.ContactTypeModelValidatorMock.Object,
                                                 mock.BOLMapperMockFactory.BOLContactTypeMapperMock,
                                                 mock.DALMapperMockFactory.DALContactTypeMapperMock,
                                                 mock.BOLMapperMockFactory.BOLBusinessEntityContactMapperMock,
                                                 mock.DALMapperMockFactory.DALBusinessEntityContactMapperMock);

            ApiContactTypeResponseModel response = await service.ByName(default(string));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.ByName(It.IsAny <string>()));
        }
Пример #4
0
        public async void TestGet()
        {
            ApiContactTypeResponseModel response = await this.Client.ContactTypeGetAsync(1);

            response.Should().NotBeNull();
        }