Ejemplo n.º 1
0
        public async void ByName_Not_Exists()
        {
            var mock = new ServiceMockFacade <IOrganizationService, IOrganizationRepository>();

            mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult <Organization>(null));
            var service = new OrganizationService(mock.LoggerMock.Object,
                                                  mock.MediatorMock.Object,
                                                  mock.RepositoryMock.Object,
                                                  mock.ModelValidatorMockFactory.OrganizationModelValidatorMock.Object,
                                                  mock.DALMapperMockFactory.DALOrganizationMapperMock,
                                                  mock.DALMapperMockFactory.DALTeamMapperMock);

            ApiOrganizationServerResponseModel response = await service.ByName("test_value");

            response.Should().BeNull();
            mock.RepositoryMock.Verify(x => x.ByName(It.IsAny <string>()));
        }
Ejemplo n.º 2
0
        public async void ByName_Exists()
        {
            var mock   = new ServiceMockFacade <IOrganizationRepository>();
            var record = new Organization();

            mock.RepositoryMock.Setup(x => x.ByName(It.IsAny <string>())).Returns(Task.FromResult(record));
            var service = new OrganizationService(mock.LoggerMock.Object,
                                                  mock.RepositoryMock.Object,
                                                  mock.ModelValidatorMockFactory.OrganizationModelValidatorMock.Object,
                                                  mock.BOLMapperMockFactory.BOLOrganizationMapperMock,
                                                  mock.DALMapperMockFactory.DALOrganizationMapperMock,
                                                  mock.BOLMapperMockFactory.BOLTeamMapperMock,
                                                  mock.DALMapperMockFactory.DALTeamMapperMock);

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

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