Example #1
0
        public void GetQueriesForQuestionsTest()
        {
            //Arrange
            var dataStorage = new Mock <IDataStorage>();
            var queries     = new List <Query>(10);

            for (int i = 0; i < 10; i++)
            {
                queries.Add(new Query {
                    Id = i, Question = new Question {
                        Id = i + 20
                    }
                });
            }
            var repository = new QueryRepository(dataStorage.Object);

            dataStorage.Setup(ds => ds.GetData <Query>()).Returns(queries);

            //Act
            var result = repository.GetQueriesForQuestions(new List <int> {
                2, 23, 29, 31, 24
            });

            //Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count(), Is.EqualTo(3));
        }
        public void GetQueriesForQuestionsTest()
        {
            //Arrange
            var dataStorage = new Mock<IDataStorage>();
            var queries = new List<Query>(10);
            for (int i = 0; i < 10; i++) {
                queries.Add(new Query {Id = i, Question = new Question {Id = i + 20}});
            }
            var repository = new QueryRepository(dataStorage.Object);
            dataStorage.Setup(ds => ds.GetData<Query>()).Returns(queries);

            //Act
            var result = repository.GetQueriesForQuestions(new List<int> {2, 23, 29, 31, 24});

            //Assert
            Assert.That(result, Is.Not.Null);
            Assert.That(result.Count(), Is.EqualTo(3));
        }