예제 #1
0
        public void MapFrom_Should_ReturnCorrectInstanceOf_CocktailCommentDto()
        {
            //Arrange
            var sut = new CocktailCommentDtoMapper();

            var cocktailComment = new CocktailComment
            {
                Cocktail = new Cocktail
                {
                    Id        = Guid.NewGuid(),
                    Name      = "testCocktail",
                    Info      = "testInfo",
                    ImagePath = "testPath",
                },
                User = new User
                {
                    Id       = Guid.NewGuid(),
                    UserName = "******",
                    Email    = "*****@*****.**"
                },
                Body      = "testBody",
                CreatedOn = DateTime.MinValue,
            };

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

            //Assert
            Assert.IsInstanceOfType(result, typeof(CocktailCommentDto));
        }
예제 #2
0
        public void MapFrom_Should_CorrectlyMapFrom_CocktailComment_To_CocktailCommentDto()
        {
            //Arrange
            var sut = new CocktailCommentDtoMapper();

            var cocktailComment = new CocktailComment
            {
                Cocktail = new Cocktail
                {
                    Id        = Guid.NewGuid(),
                    Name      = "testCocktail",
                    Info      = "testInfo",
                    ImagePath = "testPath",
                },
                User = new User
                {
                    Id       = Guid.NewGuid(),
                    UserName = "******",
                    Email    = "*****@*****.**"
                },
                Body      = "testBody",
                CreatedOn = DateTime.MinValue,
            };

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

            //Assert
            Assert.AreEqual(result.CocktailId, cocktailComment.CocktailId);
            Assert.AreEqual(result.UserId, cocktailComment.UserId);
            Assert.AreEqual(result.Body, cocktailComment.Body);
            Assert.AreEqual(result.CreatedOn, cocktailComment.CreatedOn);
        }
예제 #3
0
        public void MapFromCollection_Should_ReturnCorrectCountCommentCocktails()
        {
            //Arrange
            var sut = new CocktailCommentDtoMapper();

            var cocktailComment = new List <CocktailComment>()
            {
                new CocktailComment
                {
                    Cocktail = new Cocktail
                    {
                        Id        = Guid.NewGuid(),
                        Name      = "testCocktail",
                        Info      = "testInfo",
                        ImagePath = "testPath",
                    },
                    User = new User
                    {
                        Id       = Guid.NewGuid(),
                        UserName = "******",
                        Email    = "*****@*****.**"
                    },
                    Body      = "testBody",
                    CreatedOn = DateTime.MinValue,
                },
                new CocktailComment
                {
                    Cocktail = new Cocktail
                    {
                        Id        = Guid.NewGuid(),
                        Name      = "testCocktail2",
                        Info      = "testInfo2",
                        ImagePath = "testPath2",
                    },
                    User = new User
                    {
                        Id       = Guid.NewGuid(),
                        UserName = "******",
                        Email    = "*****@*****.**"
                    },
                    Body      = "testBody2",
                    CreatedOn = DateTime.MinValue,
                },
            };

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

            //Assert
            Assert.AreEqual(2, result.Count());
        }