Exemplo n.º 1
0
        public async Task RetrieveAsync_IdGiven_ShouldReturnNull()
        {
            // Arrange
            CatmashRepository repository = new CatmashRepository(context);

            Init();
            string id = "randomIdNotExisting";

            // Act
            Image retrieved = await repository.RetrieveAsync(id);

            // Assert
            Assert.Null(retrieved);
        }
Exemplo n.º 2
0
        public async Task RetrieveAsync_IndexGiven_ShouldReturnNull()
        {
            // Arrange
            CatmashRepository repository = new CatmashRepository(context);

            Init();
            int index = int.MaxValue;

            // Act
            Image retrieved = await repository.RetrieveAsync(index);

            // Assert
            Assert.Null(retrieved);
        }
Exemplo n.º 3
0
        public async Task RetrieveAsync_IdGiven_ShouldReturnImage()
        {
            // Arrange
            CatmashRepository repository = new CatmashRepository(context);

            Init();
            Image toRetrieve = new Image {
                Id = "bar", Url = "www.bar.com", Score = 120.43M, Votes = 2435
            };

            // Act
            Image retrieved = await repository.RetrieveAsync(toRetrieve.Id);

            // Assert
            Assert.Equal(toRetrieve, retrieved, new ImagePropertiesComparer());
        }
Exemplo n.º 4
0
        public async Task RetrieveAsync_IndexGiven_ShouldReturnImage()
        {
            // Arrange
            CatmashRepository repository = new CatmashRepository(context);

            Init();
            Image toRetrieve = new Image {
                Id = "foo", Url = "www.foo.com", Score = 452.865M, Votes = 985
            };

            // Act
            Image retrieved = await repository.RetrieveAsync(3);

            // Assert
            Assert.Equal(toRetrieve, retrieved, new ImagePropertiesComparer());
        }