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

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

            List <ApiOrganizationServerResponseModel> response = await service.All();

            response.Should().HaveCount(1);
            mock.RepositoryMock.Verify(x => x.All(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>()));
        }