Esempio n. 1
0
        public async void Get_null_record()
        {
            var mock = new ServiceMockFacade <IChannelRepository>();

            mock.RepositoryMock.Setup(x => x.Get(It.IsAny <string>())).Returns(Task.FromResult <Channel>(null));
            var service = new ChannelService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.ChannelModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLChannelMapperMock,
                                             mock.DALMapperMockFactory.DALChannelMapperMock);

            ApiChannelResponseModel response = await service.Get(default(string));

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.Get(It.IsAny <string>()));
        }
Esempio n. 2
0
        public async void ByNameProjectId_Exists()
        {
            var mock   = new ServiceMockFacade <IChannelRepository>();
            var record = new Channel();

            mock.RepositoryMock.Setup(x => x.ByNameProjectId(It.IsAny <string>(), It.IsAny <string>())).Returns(Task.FromResult(record));
            var service = new ChannelService(mock.LoggerMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.ChannelModelValidatorMock.Object,
                                             mock.BOLMapperMockFactory.BOLChannelMapperMock,
                                             mock.DALMapperMockFactory.DALChannelMapperMock);

            ApiChannelResponseModel response = await service.ByNameProjectId(default(string), default(string));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.ByNameProjectId(It.IsAny <string>(), It.IsAny <string>()));
        }
Esempio n. 3
0
        public async void TestGet()
        {
            ApiChannelResponseModel response = await this.Client.ChannelGetAsync("A");

            response.Should().NotBeNull();
        }