Пример #1
0
        public void MapFrom_Should_CorrectlyMapRatingFrom_Cocktail_To_DetailsCocktailDto_WhenCollectionIsNotEmpty()
        {
            //Arrange
            var sut = new DetailsCocktailDtoMapper();

            var cocktail = new Cocktail
            {
                Id        = Guid.NewGuid(),
                Name      = "testName",
                Info      = "testInfo",
                ImagePath = "testPath",
                Ratings   = new List <CocktailRating>()
                {
                    new CocktailRating
                    {
                        Value = 4.55,
                    }
                }
            };

            //Act
            var result = sut.MapFrom(cocktail);

            //Assert
            Assert.AreEqual(result.AverageRating, 4.55);
        }
Пример #2
0
        public void MapFromCollection_Should_ReturnCorrectCountCocktails()
        {
            //Arrange
            var sut = new DetailsCocktailDtoMapper();

            var cocktails = new List <Cocktail>()
            {
                new Cocktail
                {
                    Id        = Guid.NewGuid(),
                    Name      = "testName",
                    Info      = "testInfo",
                    ImagePath = "testPath",
                },
                new Cocktail
                {
                    Id        = Guid.NewGuid(),
                    Name      = "testName2",
                    Info      = "testInfo2",
                    ImagePath = "testPath2",
                }
            };

            //Act
            var result = sut.MapFrom(cocktails);

            //Assert
            Assert.AreEqual(2, result.Count());
        }
Пример #3
0
        public void MapFrom_Should_ReturnCorrectInstanceOfCollection_CocktailDto()
        {
            //Arrange
            var sut = new DetailsCocktailDtoMapper();

            var cocktails = new List <Cocktail>()
            {
                new Cocktail
                {
                    Id        = Guid.NewGuid(),
                    Name      = "testName",
                    Info      = "testInfo",
                    ImagePath = "testPath",
                },
                new Cocktail
                {
                    Id        = Guid.NewGuid(),
                    Name      = "testName2",
                    Info      = "testInfo2",
                    ImagePath = "testPath2",
                }
            };

            //Act
            var result = sut.MapFrom(cocktails);

            //Assert
            Assert.IsInstanceOfType(result, typeof(List <DetailsCocktailDto>));
        }
Пример #4
0
        public void MapFrom_Should_ReturnCorrectInstanceOf_DetailsCocktailDto()
        {
            //Arrange
            var sut = new DetailsCocktailDtoMapper();

            var cocktail = new Cocktail
            {
                Id        = Guid.NewGuid(),
                Name      = "testName",
                Info      = "testInfo",
                ImagePath = "testPath",
            };

            //Act
            var result = sut.MapFrom(cocktail);

            //Assert
            Assert.IsInstanceOfType(result, typeof(DetailsCocktailDto));
        }