コード例 #1
0
        public void Find_emptyNameAndValidTitle_CallsFindByJobTitleRepositoryMethod()
        {
            var employeeRepository = MockRepository.GenerateMock<IEmployeeRepository>();
            var provider = new EmployeeProvider(employeeRepository, _jobTitleProvider);

            provider.Find(null, TitleId);

            employeeRepository.AssertWasCalled(r => r.FindByJobTitle(_jobTitle));
        }
コード例 #2
0
        public void Find_validNameAndNullTitle_CallsListAllRepositoryMethod()
        {
            var employeeRepository = MockRepository.GenerateMock<IEmployeeRepository>();
            var jobTitleProvider = MockRepository.GenerateStub<IJobTitleProvider>();
            var provider = new EmployeeProvider(employeeRepository, jobTitleProvider);

            provider.Find(Name, 0);

            employeeRepository.AssertWasCalled(r => r.ListAll());
        }
コード例 #3
0
        public void GetById_validId_callsRepository()
        {
            var employeeRepository = MockRepository.GenerateMock<IEmployeeRepository>();
            employeeRepository.Stub(e => e.GetById(EmployeeId)).Return(_employee);
            var jobTitleProvider = MockRepository.GenerateStub<IJobTitleProvider>();
            var provider = new EmployeeProvider(employeeRepository, jobTitleProvider);

            var results = provider.GetById(EmployeeId);

            employeeRepository.AssertWasCalled(e => e.GetById(EmployeeId));
        }
コード例 #4
0
        public void Find_validNameAndNullTitle_FiltersResultsByName()
        {
            var employeeRepository = MockRepository.GenerateMock<IEmployeeRepository>();
            employeeRepository.Stub(e => e.ListAll()).Return(GenerateListOfEmployees());
            var jobTitleProvider = MockRepository.GenerateStub<IJobTitleProvider>();
            var provider = new EmployeeProvider(employeeRepository, jobTitleProvider);

            var results = provider.Find(Name, 0);

            Assert.That(results.Count == 2);
        }