示例#1
0
        public void RecipeItem_ToDomainModel_ShouldMapNullItem()
        {
            DB.RecipeItem dbItem = null;
            RecipeItem    item   = EntityMapper.ToDomainModel(dbItem);

            item.Should().BeNull();
        }
示例#2
0
        public void RecipeItem_ToDomainModel_ShouldMapNonNullItem()
        {
            DB.RecipeItem dbItem = new DB.RecipeItem
            {
                Id   = 1,
                Item = new DB.Item {
                    Id = 1, Name = "Onion"
                },
                RequiredQuantity = new Quantity {
                    Amount = 100, Unit = "g"
                },
                Adjectives = new List <string> {
                    "cooked", "chopped"
                }
            };

            RecipeItem item = EntityMapper.ToDomainModel(dbItem);

            dbItem.Should().NotBeNull();
            dbItem.Id.Should().Be(1);
            dbItem.Item.Should().NotBeNull();
            dbItem.RequiredQuantity.Should().NotBeNull();
            dbItem.RequiredQuantity.Amount.Should().Be(100);
            dbItem.RequiredQuantity.Unit.Should().Be("g");
            dbItem.Adjectives.Should().NotBeNullOrEmpty();
            dbItem.Adjectives.Should().HaveCount(2);
            dbItem.Adjectives.Should().Contain(new List <string> {
                "cooked", "chopped"
            });
        }
示例#3
0
        public void RecipeItem_ToDatabaseModel_ShouldMapNullItem()
        {
            RecipeItem item = null;

            DB.RecipeItem dbItem = EntityMapper.ToDatabaseModel(item);
            dbItem.Should().BeNull();
        }