Beispiel #1
0
        public void ReturnCorrectInstance_OfType_ICollectionIngredientDto()
        {
            //Arrange
            var sut = new IngredientDtoMapper();

            var ingredients = new List <Ingredient>
            {
                new Ingredient
                {
                    Id   = 1,
                    Name = "TestIngredient1",
                },
                new Ingredient
                {
                    Id   = 2,
                    Name = "TestIngredient2",
                },
            };
            //Act
            var result = sut.MapDto(ingredients);

            //Assert
            Assert.IsInstanceOfType(result, typeof(ICollection <IngredientDto>));
            Assert.AreEqual(result.First().Id, ingredients[0].Id);
            Assert.AreEqual(result.First().Name, ingredients[0].Name);
            Assert.AreEqual(result.Last().Id, ingredients[1].Id);
            Assert.AreEqual(result.Last().Name, ingredients[1].Name);
        }
        public void MapFromCollection_Should_ReturnCorrectCountIngredients()
        {
            //Arrange
            var sut = new IngredientDtoMapper();

            var ingredientList = new List <Ingredient>()
            {
                new Ingredient
                {
                    Id   = Guid.NewGuid(),
                    Name = "testName"
                },
                new Ingredient
                {
                    Id   = Guid.NewGuid(),
                    Name = "testName2"
                }
            };

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

            //Assert
            Assert.AreEqual(result.Count(), 2);
        }
        public void MapFromCollection_Should_ReturnCorrectInstanceOfCollection_IngredientDto()
        {
            //Arrange
            var sut = new IngredientDtoMapper();

            var ingredientList = new List <Ingredient>()
            {
                new Ingredient
                {
                    Id   = Guid.NewGuid(),
                    Name = "testName"
                },
                new Ingredient
                {
                    Id   = Guid.NewGuid(),
                    Name = "testName2"
                }
            };

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

            //Assert
            Assert.IsInstanceOfType(result, typeof(List <IngredientDto>));
        }
        public void MapFrom_Should_ReturnCorrectInstanceOf_IngredientDto()
        {
            //Arrange
            var sut = new IngredientDtoMapper();

            var ingredient = new Ingredient
            {
                Id   = Guid.NewGuid(),
                Name = "testName"
            };

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

            //Assert
            Assert.IsInstanceOfType(result, typeof(IngredientDto));
        }
        public void MapFrom_Should_CorrectlyMapFrom_Ingredient_To_IngredientDto()
        {
            //Arrange
            var sut = new IngredientDtoMapper();

            var ingredient = new Ingredient
            {
                Id   = Guid.NewGuid(),
                Name = "testName"
            };

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

            //Assert
            Assert.AreEqual(result.Id, ingredient.Id);
            Assert.AreEqual(result.Name, ingredient.Name);
        }
Beispiel #6
0
        public void ReturnCorrectInstance_OfType_IngredientDto()
        {
            //Arrange
            var sut = new IngredientDtoMapper();

            var ingredient = new Ingredient
            {
                Id   = 1,
                Name = "TestIngredient",
            };

            //Act
            var result = sut.MapDto(ingredient);

            //Assert
            Assert.IsInstanceOfType(result, typeof(IngredientDto));
            Assert.AreEqual(result.Id, ingredient.Id);
            Assert.AreEqual(result.Name, ingredient.Name);
        }