示例#1
0
        public async void StudentsByFamilyId_Not_Exists()
        {
            var mock = new ServiceMockFacade <IFamilyService, IFamilyRepository>();

            mock.RepositoryMock.Setup(x => x.StudentsByFamilyId(default(int), It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult <List <Student> >(new List <Student>()));
            var service = new FamilyService(mock.LoggerMock.Object,
                                            mock.MediatorMock.Object,
                                            mock.RepositoryMock.Object,
                                            mock.ModelValidatorMockFactory.FamilyModelValidatorMock.Object,
                                            mock.DALMapperMockFactory.DALFamilyMapperMock,
                                            mock.DALMapperMockFactory.DALStudentMapperMock);

            List <ApiStudentServerResponseModel> response = await service.StudentsByFamilyId(default(int));

            response.Should().BeEmpty();
            mock.RepositoryMock.Verify(x => x.StudentsByFamilyId(default(int), It.IsAny <int>(), It.IsAny <int>()));
        }