Example #1
0
        public async void ByName_Not_Exists()
        {
            var mock = new ServiceMockFacade <IProxyRepository>();

            mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult <Proxy>(null));
            var service = new ProxyService(mock.LoggerMock.Object,
                                           mock.RepositoryMock.Object,
                                           mock.ModelValidatorMockFactory.ProxyModelValidatorMock.Object,
                                           mock.BOLMapperMockFactory.BOLProxyMapperMock,
                                           mock.DALMapperMockFactory.DALProxyMapperMock);

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

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