public void Setup() { this.userRepositoryMock = new Mock<IUserRepository>(); this.cryptoProvider = new CryptoProvider(); this.humanTaskRepositoryMock = new Mock<IHumanTaskRepository>(); this.reminderProcessor = new Mock<IReminderProcessor>(); this.taskProcessor = new TaskProcessor(this.humanTaskRepositoryMock.Object, this.reminderProcessor.Object, this.userRepositoryMock.Object); this.userProcessor = new UserProcessor(this.userRepositoryMock.Object, this.cryptoProvider, this.taskProcessor); }
public void TaskProcessorTestsSetup() { mockHumanTaskRepository = new Mock<IHumanTaskRepository>(); //mockHumanTaskRepository.Setup(mr => mr.GetAll()).Returns(tasks); //mockHumanTaskRepository.Setup(mr => mr.GetAllTasksForEmployee(It.IsAny<int>())).Returns((int id) => // tasks.Where(x => x.AssigneeId == id)); //mockHumanTaskRepository.Setup(mr => mr.GetAllTasksForEmployee(It.IsAny<int>())).Returns((int id) => // tasks.Where(x => x.CreatorId == id)); //mockHumanTaskRepository.Setup(mr => mr.GetById(It.IsAny<int>())).Returns((int id) => // tasks.Where(x => x.Id == id).Single()); //mockHumanTaskRepository.Setup(mr => mr.Add(It.IsAny<HumanTask>())).Returns((HumanTask target) => //{ // target.Id = tasks.Count() + 1; // tasks.Add(target); // return target; //}); //mockHumanTaskRepository.Setup(it => it.Delete(It.IsAny<int>())).Callback<int>(id => //{ // var ttr = tasks.FirstOrDefault(it => it.Id == id); // if (ttr != null) // { // tasks.Remove(ttr); // } //}); this.mockReminderProcessor = new Mock<IReminderProcessor>(); this.mockUserRepository = new Mock<IUserRepository>(); this.processorUnderTest = new TaskProcessor(this.mockHumanTaskRepository.Object, this.mockReminderProcessor.Object, mockUserRepository.Object); }