예제 #1
0
        public async Task GetAllCollectionsAsync_Should_Return_3_Collections()
        {
            // Arrange
            CollectionDto expectedCollectionDto1 = new CollectionDto
            {
                UserId = 1,
                Name   = "Dank Memes1"
            };
            Collection entity1 = DtoToEntityConverter.Convert <Collection, CollectionDto>(expectedCollectionDto1);
            await CollectionRepository.CreateAsync(entity1);

            CollectionDto expectedCollectionDto2 = new CollectionDto
            {
                UserId = 1,
                Name   = "Dank Memes2"
            };
            Collection entity2 = DtoToEntityConverter.Convert <Collection, CollectionDto>(expectedCollectionDto2);
            await CollectionRepository.CreateAsync(entity2);

            CollectionDto expectedCollectionDto3 = new CollectionDto
            {
                UserId = 1,
                Name   = "Dank Memes3"
            };
            Collection entity3 = DtoToEntityConverter.Convert <Collection, CollectionDto>(expectedCollectionDto3);
            await CollectionRepository.CreateAsync(entity3);

            // Act
            CollectionDto actualCollectionDto1 = (await CollectionService.GetAllCollectionsAsync()).First();
            CollectionDto actualCollectionDto2 = (await CollectionService.GetAllCollectionsAsync()).Skip(1).First();
            CollectionDto actualCollectionDto3 = (await CollectionService.GetAllCollectionsAsync()).Skip(2).First();

            // Assert
            Assert.AreEqual(expectedCollectionDto1, actualCollectionDto1);
            Assert.AreEqual(expectedCollectionDto2, actualCollectionDto2);
            Assert.AreEqual(expectedCollectionDto3, actualCollectionDto3);
        }