public override void SetUp()
 {
     base.SetUp();
     dao = Mock.Of<IQuestionaryDao>();
     Mock<IQuestionaryDao> mock = Mock.Get(dao);
     mock.Setup(mockDao => mockDao.AllQuestionaries()).Returns(ReadAllQuestionaries);
     mock.Setup(mockDao => mockDao.Add(It.IsAny<Questionary>())).Callback<Questionary>(AddQuestionary);
     mock.Setup(mockDao => mockDao.Change(It.IsAny<Questionary>())).Callback<Questionary>(ChangeQuestionary);
     handler = new QuestionaryHandler { Dao = dao };
 }
 public override void SetUp()
 {
     base.SetUp();
     //другие интересные возможности синтаксиса Moq смотри здесь: http://sergeyteplyakov.blogspot.com/2012/09/moq.html
     //к сожалению, на первую инициализацию требуется время - но чем-то всегда приходится платить за удобство
     repository = Mock.Of<IQuestionaryRepository>();
     Mock<IQuestionaryRepository> mock = Mock.Get(repository);
     mock.Setup(mockDao => mockDao.AllQuestionaries()).Returns(ReadAllQuestionaries);
     mock.Setup(mockRepo => mockRepo.Add(It.IsAny<Questionary>())).Callback<Questionary>(AddQuestionary);
     mock.Setup(mockRepo => mockRepo.Change(It.IsAny<Questionary>())).Callback<Questionary>(ChangeQuestionary);
     mock.Setup(mockRepo => mockRepo.Contains(It.IsAny<Questionary>())).Returns<Questionary>(Contains);
     dao = new QuestionaryDao { Repository = () => repository };
 }