Ejemplo n.º 1
0
        public async void ByExternalId_Not_Exists()
        {
            var mock = new ServiceMockFacade <ILinkService, ILinkRepository>();

            mock.RepositoryMock.Setup(x => x.ByExternalId(It.IsAny <Guid>())).Returns(Task.FromResult <Link>(null));
            var service = new LinkService(mock.LoggerMock.Object,
                                          mock.MediatorMock.Object,
                                          mock.RepositoryMock.Object,
                                          mock.ModelValidatorMockFactory.LinkModelValidatorMock.Object,
                                          mock.DALMapperMockFactory.DALLinkMapperMock,
                                          mock.DALMapperMockFactory.DALLinkLogMapperMock);

            ApiLinkServerResponseModel response = await service.ByExternalId(default(Guid));

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