Exemplo n.º 1
0
        public async void ByFamilyId_Not_Exists()
        {
            var mock = new ServiceMockFacade <IStudentService, IStudentRepository>();

            mock.RepositoryMock.Setup(x => x.ByFamilyId(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>())).Returns(Task.FromResult <List <Student> >(new List <Student>()));
            var service = new StudentService(mock.LoggerMock.Object,
                                             mock.MediatorMock.Object,
                                             mock.RepositoryMock.Object,
                                             mock.ModelValidatorMockFactory.StudentModelValidatorMock.Object,
                                             mock.DALMapperMockFactory.DALStudentMapperMock,
                                             mock.DALMapperMockFactory.DALEventStudentMapperMock);

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

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