Exemple #1
0
 private ModelCategory ConvertCategory(EntityCategory category)
 {
     return(new ModelCategory
     {
         Id = category.Id,
         Name = category.Name,
         Description = category.Description
     });
 }
        private FakeDataContext CreateDataContext()
        {
            var context  = new FakeDataContext();
            var product1 = new Good
            {
                Id          = product_1,
                Name        = "Product1",
                Description = "Product one"
            };
            var product2 = new Good
            {
                Id          = product_2,
                Name        = "Product2",
                Description = "Product two",
            };

            var category1 = new EntityCategory
            {
                Id          = category_1,
                Name        = "Category1",
                Description = "Category one"
            };
            var reference = new CategoryGoodReference
            {
                Id       = Guid.NewGuid(),
                Category = category1,
                Good     = product1
            };

            context.SetCollectionAsDbSet(new List <Good> {
                product1, product2
            });
            context.SetCollectionAsDbSet(new List <EntityCategory> {
                category1
            });
            context.SetCollectionAsDbSet(new List <CategoryGoodReference> {
                reference
            });
            return(context);
        }
        private FakeDataContext CreateDataContext()
        {
            var context = new FakeDataContext();

            var category1 = new EntityCategory
            {
                Id          = category_1,
                Name        = "Category1",
                Description = "Category one"
            };
            var category2 = new EntityCategory
            {
                Id          = category_2,
                Name        = "Category2",
                Description = "Category two"
            };

            context.SetCollectionAsDbSet(new List <EntityCategory> {
                category1, category2
            });
            return(context);
        }