示例#1
0
        public PollsServiceTests(ContextFixture contextFixture, DbSetFixture dbSetFixture, RepositoryFixture repositoryFixture)
        {
            _contextFixture = contextFixture;
            _dbSetFixture   = dbSetFixture;

            var data        = new TestData().GetPollsData();
            var mockSet     = _dbSetFixture.CreateMockSet <Poll>(data);
            var mockContext = _contextFixture.CreateMockContext <Poll>(mockSet).Object;

            _repositoryMock = repositoryFixture.CreateRepository <PollsRepository, Poll>(mockContext);

            var answersData    = new TestData().GetUserPollAnswers();
            var answersSet     = _dbSetFixture.CreateMockSet <UserPollAnswer>(answersData);
            var answersContext = _contextFixture.CreateMockContext <UserPollAnswer>(answersSet).Object;

            _answersRepository = repositoryFixture.CreateRepository <UserPollAnswersRepository, UserPollAnswer>(answersContext);
        }