Example #1
0
        public void ShouldReturnContributorsWhenTakeIs50()
        {
            // Arrange
            var filter = ContributorFilterDtoFactory.CreateWithTake(50);

            var expected = ContributorFactory.CreateList(50);

            contributorRepository.GetByCityAsync(filter.CityName, Arg.Any <int>(), Arg.Any <int>()).Returns(expected);
            contributorFilterValidator.Validate(filter).Returns(true);

            // Act
            var actual = sut.GetContributorsByCityAsync(filter);

            // Assert
            Assert.IsNotNull(actual);
        }
Example #2
0
        public async Task ShouldReturnContributorsWhenTakeIs100()
        {
            // Arrange
            var filter   = ContributorFilterDtoFactory.CreateWithTake(100);
            var expected = ContributorFactory.CreateList(filter.Take);

            contributorRepository.GetByCityAsync(filter.CityName, 1, 100).Returns(expected);
            contributorFilterValidator.Validate(filter).Returns(true);

            // Act
            var actual = await sut.GetContributorsByCityAsync(filter);

            // Assert
            Assert.AreEqual(expected.Count(), actual.Count());
            Assert.AreEqual(expected.First().Username, actual.First().Username);
            Assert.AreEqual(expected.Last().Username, actual.Last().Username);
        }