public void VerifyDatabaseInsertOfJobWithPowerToolsTenant()
        {
            var helper   = new TestContextHelper("test_in-memory_DB-" + RandomNumberHelper.NextInteger());
            var context  = new JobAssistantContext(helper.Options);
            var ptDomain = new Tenant {
                DomainId = "Power Tools"
            };

            context.Tenants.Add(ptDomain);

            var grindJob = new Job
            {
                Name     = "Grind",
                DomainId = ptDomain.DomainId
            };

            Assert.True(grindJob.JobId == 0);
            context.Jobs.Add(grindJob);
            var efDefaultId = grindJob.JobId; // Temporarily assigned by EF

            Assert.True(efDefaultId > 0);
            var savedCount = context.SaveChanges();

            Assert.True(savedCount == 2);
            Assert.True(grindJob.JobId > 0); // New id is likely different than temporary id assigned above
        }
        public async void RepositoryCreateCategoryAndJobTest()
        {
            int nextId = RandomNumberHelper.NextInteger();

            using (var context = new JobAssistantContext(helper.Options)) {
                var category = new Category {
                    CategoryId = nextId, Name = "Test Category " + nextId
                };
                var job = new Job {
                    JobId = nextId, Name = "Test Job " + nextId
                };
                category.Jobs = new List <Job>();
                category.Jobs.Add(job);

                var repositoryUnderTest = new Repository(context);
                await repositoryUnderTest.Create <Category>(category);
            }

            using (var context = new JobAssistantContext(helper.Options)) {
                var repositoryUnderTest = new Repository(context);
                var parentCategory      = repositoryUnderTest.All <Category>().Include(c => c.Jobs).Single(c => c.CategoryId == nextId);
                Assert.NotNull(parentCategory);
                Assert.NotNull(parentCategory.Jobs);
                Assert.Equal(1, parentCategory.Jobs.Count);
                var childJob = parentCategory.Jobs.Single(j => j.JobId == nextId);
                Assert.Equal("Test Job " + nextId, childJob.Name);
                context.Remove(parentCategory);
                context.SaveChanges();
                var hasCategory = context.Categories.Any(c => c.CategoryId == nextId);
                Assert.False(hasCategory);
            }
        }
        public void VerifyDatabaseInsertOfNewTrade()
        {
            var helper    = new TestContextHelper("test_in-memory_DB-" + RandomNumberHelper.NextInteger());
            var context   = new JobAssistantContext(helper.Options);
            var autoTrade = new Trade {
                Name = "Automotive and Other Vehicle Maintenance"
            };

            Assert.True(autoTrade.TradeId == 0);
            context.Trades.Add(autoTrade);
            var efDefaultId = autoTrade.TradeId;

            Assert.True(efDefaultId > 0);
            var savedCount = context.SaveChanges();

            Assert.True(savedCount == 1);
            Assert.True(autoTrade.TradeId > 0);
        }
Ejemplo n.º 4
0
        public void VerifyDatabaseInsertOfNewApplication()
        {
            var helper      = new TestContextHelper("test_in-memory_DB-" + RandomNumberHelper.NextInteger());
            var context     = new JobAssistantContext(helper.Options);
            var application = new Application {
                Name = "Level"
            };

            Assert.True(application.ApplicationId == 0);
            context.Applications.Add(application);
            var efDefaultId = application.ApplicationId;

            Assert.True(efDefaultId > 0);
            var savedCount = context.SaveChanges();

            Assert.True(savedCount == 1);
            Assert.True(application.ApplicationId > 0);
        }
Ejemplo n.º 5
0
        public void AddAndUpdateMaterialsWithJobsDbSetQueryTest()
        {
            var nextId = RandomNumberHelper.NextInteger();

            var parentCategory = new Category();

            parentCategory.CategoryId = nextId;
            parentCategory.Name       = "Test Category " + nextId;
            parentCategory.Jobs       = new List <Job>();

            var job = new Job {
                JobId = nextId, Name = "Test Job " + nextId
            };

            var material = new Material {
                MaterialId = nextId, Name = "Test Material " + nextId
            };

            job.Materials = new List <Material>();
            job.Materials.Add(material);

            parentCategory.Jobs.Add(job);

            var helper = new TestContextHelper("test_in-memory_DB-" + RandomNumberHelper.NextInteger());

            using (var saveContext = new JobAssistantContext(helper.Options))
            {
                saveContext.Add(parentCategory);
                var entitiesPeristed = saveContext.SaveChanges();
                Assert.Equal(3, entitiesPeristed); // Expect 3 because a category, job and material are being persisted.
            }

            using (var queryContext = new JobAssistantContext(helper.Options))
            {
                var myJob = queryContext.Jobs.Include(j => j.Materials).Single(j => j.JobId == nextId);
                Assert.Equal("Test Job " + nextId, myJob.Name);
                Assert.True(myJob.Materials.Count == 1);
                var someMaterial = queryContext.Materials.Single(m => m.MaterialId == nextId);
                Assert.Equal("Test Material " + nextId, someMaterial.Name);
                var expectedCategoryName = "Test Category " + nextId;
                var topCategory          = queryContext.Categories.Single(c => c.CategoryId == nextId);
                Assert.Equal(expectedCategoryName, topCategory.Name);
            }
        }
        public void VerifyDatabaseInsertOfCategory()
        {
            var helper  = new TestContextHelper("test_in-memory_DB-" + RandomNumberHelper.NextInteger());
            var context = new JobAssistantContext(helper.Options);
            var dremelMultiPurposeCategory = new Category()
            {
                Name = "Multi-Purpose"
            };

            Assert.True(dremelMultiPurposeCategory.CategoryId == 0);
            context.Categories.Add(dremelMultiPurposeCategory);
            var efDefaultId = dremelMultiPurposeCategory.CategoryId; // Temporarily assigned by EF

            Assert.True(efDefaultId > 0);
            int savedCount = context.SaveChanges();

            Assert.True(savedCount == 1);
            Assert.True(dremelMultiPurposeCategory.CategoryId > 0); // New id is likely different than temporary id assigned above
        }
Ejemplo n.º 7
0
        private void SetupTestToolData()
        {
            var toolId = RandomNumberHelper.NextInteger();
            var tool   = new Tool {
                ToolId = toolId, Name = "Hammer Tool " + toolId
            };
            var materialId = RandomNumberHelper.NextInteger();
            var material   = new Material
            {
                MaterialId = materialId,
                Name       = "Material " + materialId,
                Tools      = new List <Tool> {
                    tool
                }
            };
            var jobId = RandomNumberHelper.NextInteger();
            var job   = new Job
            {
                JobId     = jobId,
                Name      = "Job " + jobId,
                Materials = new List <Material> {
                    material
                }
            };
            var categoryId = RandomNumberHelper.NextInteger();
            var category   = new Category
            {
                CategoryId = categoryId,
                Name       = "Category " + categoryId,
                Jobs       = new List <Job> {
                    job
                }
            };

            context.Add(category);
            context.SaveChanges();

            toolUnderTest = tool;
        }
Ejemplo n.º 8
0
        public void VerifyDatabaseInsertOfPowerTool()
        {
            var helper      = new TestContextHelper("test_in-memory_DB-" + RandomNumberHelper.NextInteger());
            var context     = new JobAssistantContext(helper.Options);
            var hammerDrill = new Tool
            {
                Name           = "Variable Speed Hammer Drill Kit",
                ModelNumber    = "1191VSRK",
                Attributes     = "{ \"Weight\" : \"7.8 pounds\", \"Package Dimensions\" = \"14 x 11.9 x 4.3 inches\", \"Color\" = \"Blue\" }",
                MaterialNumber = "B000VZJGAO"
            };

            Assert.True(hammerDrill.ToolId == 0);
            context.Tools.Add(hammerDrill);
            var efDefaultId = hammerDrill.ToolId; // Temporarily assigned by EF

            Assert.True(efDefaultId > 0);
            int savedCount = context.SaveChanges();

            Assert.True(savedCount == 1);
            Assert.True(hammerDrill.ToolId > 0); // New id is likely different than temporary id assigned above
        }
Ejemplo n.º 9
0
        public void AddAndUpdateMaterialsWithIncludesAndTraversalTest()
        {
            var nextId = RandomNumberHelper.NextInteger();

            var parentCategory = new Category();

            parentCategory.CategoryId = nextId;
            parentCategory.Jobs       = new List <Job>();

            var job = new Job {
                JobId = nextId, Name = "Test Job " + nextId
            };

            var material = new Material {
                MaterialId = nextId, Name = "Test Material " + nextId
            };

            job.Materials = new List <Material>();
            job.Materials.Add(material);

            parentCategory.Jobs.Add(job);

            var helper = new TestContextHelper("test_in-memory_DB-" + RandomNumberHelper.NextInteger());

            using (var context = new JobAssistantContext(helper.Options))
            {
                context.Add(parentCategory);
                var entitiesPeristed = context.SaveChanges();
                Assert.Equal(3, entitiesPeristed); // Expect 3 because a category, job and material are being persisted.
            }

            using (var context = new JobAssistantContext(helper.Options))
            {
                var myJob = context.Categories.Include(c => c.Jobs).ThenInclude(m => m.Materials)
                            .ThenInclude(t => t.Tools).Single(c => c.CategoryId == nextId).Jobs.Single(j => j.JobId == nextId);
                Assert.Equal("Test Job " + nextId, myJob.Name);
            }
        }
Ejemplo n.º 10
0
        public void VerifyDatabaseInsertOfAccessoryBit()
        {
            var helper  = new TestContextHelper("test_in-memory_DB-" + RandomNumberHelper.NextInteger());
            var context = new JobAssistantContext(helper.Options);
            var bit     = new Accessory
            {
                Name           = "5/16 In. x 12 In. Bell Hanger Bits",
                ModelNumber    = "BH1002",
                Attributes     = "{ \"Weight\" : \"2.4 ounces\", \"Size\" = \"5/16-Inch\", \"Color\" = \"Blue\" }",
                SocialRating   = 5M,
                MaterialNumber = "B000WA3M9E"
            };

            Assert.True(bit.AccessoryId == 0);
            context.Accessories.Add(bit);
            var efDefaultId = bit.AccessoryId; // Temporarily assigned by EF

            Assert.True(efDefaultId > 0);
            int savedCount = context.SaveChanges();

            Assert.True(savedCount == 1);
            Assert.True(bit.AccessoryId > 0); // New id is likely different than temporary id assigned above
        }
Ejemplo n.º 11
0
        public void LoadGraphAndVerifyFirstMaterialAndToolTest()
        {
            using (var context = new JobAssistantContext(_helper.Options))
            {
                var laminatedWoodMaterial = (from m in context.Materials.Include(m => m.Tools) where m.Name == "Laminated Wood / Composite Materials" select m).First();
                Assert.NotNull(laminatedWoodMaterial);
                Assert.True(laminatedWoodMaterial.MaterialId > 0);

                Assert.True(laminatedWoodMaterial.Tools.Count == 0);

                var newTool = new Tool()
                {
                    ToolId = 123654
                };
                laminatedWoodMaterial.Tools.Add(newTool);
                int lastSaveCount = context.SaveChanges();
                Assert.Equal(1, lastSaveCount);

                var tool123654 = (from t in context.Tools where t.ToolId == 123654 select t).First();
                Assert.NotNull(tool123654);
                Assert.Equal(123654, tool123654.ToolId);
            }
        }
        public void RepositoryCreateFetchListOfCategoriesTest()
        {
            using (var context = new JobAssistantContext(_helper.Options))
            {
                ICollection <int> verifySelectIds = new List <int>();
                var repositoryUnderTest           = new Repository(context);
                for (int i = 0, nextId = RandomNumberHelper.NextInteger(); i < 10; i++)
                {
                    int categoryId = nextId + i;
                    if (i == 4 || i == 6)
                    {
                        verifySelectIds.Add(categoryId);
                    }
                    var testCategoryCreated = repositoryUnderTest.Create <Category>(new Category {
                        CategoryId = categoryId, Name = "Test Category " + categoryId
                    });
                    Assert.NotNull(testCategoryCreated);
                }
                context.SaveChanges();

                Assert.NotNull(context.Categories);
                var categoryCount = context.Categories.Count();
                Assert.True(categoryCount == 10);
                Assert.NotNull(context.Categories.First());
                Assert.NotNull(context.Categories.Last());

                var enumerator = verifySelectIds.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    int nextCategoryId = enumerator.Current;
                    var verifyCategory = repositoryUnderTest.Single <Category>(c => c.CategoryId == nextCategoryId);
                    Assert.NotNull(verifyCategory);
                }
                enumerator.Dispose();
            }
        }
        public static int SeedDremelGraphData(JobAssistantContext jobContext)
        {
            #region Tenants defined

            // TODO: Tenants has already been initialized!
            jobContext.Tenants.AddRange(new List <Tenant> {
                DremelDataTenant
            });
            // TODO: jobContext.Tenants.Add(DremelDataTenant);
            jobContext.SaveChanges();

            #endregion

            var rotaryCategory = new Category {
                Name = "Rotary", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Categories.Add(rotaryCategory);

            var sawsCategory = new Category {
                Name = "Saws", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Categories.Add(sawsCategory);

            var multiPurposeCategory = new Category {
                Name = "Multi-Purpose", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Categories.Add(multiPurposeCategory);

            var hatchProjectCategory = new Category {
                Name = "Hatch Project Kits", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Categories.Add(hatchProjectCategory);

            var printer3DCategory = new Category {
                Name = "3D Printer", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Categories.Add(printer3DCategory);


            var sandingJob = new Job {
                JobId = 95001, Name = "Sanding", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Jobs.Add(sandingJob);

            var cuttingScrapingJob = new Job {
                JobId = 95002, Name = "Cutting & Scraping", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Jobs.Add(cuttingScrapingJob);

            var etchingEngravingJob = new Job {
                JobId = 95003, Name = "Etching & Engraving", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Jobs.Add(etchingEngravingJob);

            var routingDrillingJob = new Job {
                JobId = 95004, Name = "Routing & Drilling", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Jobs.Add(routingDrillingJob);

            var grindingSharpeningJob = new Job {
                JobId = 95005, Name = "Grinding & Sharpening", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Jobs.Add(grindingSharpeningJob);

            var cleaningPolishingJob = new Job {
                JobId = 95006, Name = "Cleaning & Polishing", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Jobs.Add(cleaningPolishingJob);

            var accessoryKitCategory =
                new Category {
                Name = "Accessory Kits & Sets", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Categories.Add(accessoryKitCategory);

            var attachmentPartKitCategory =
                new Category {
                Name = "Attachments & Parts", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Categories.Add(attachmentPartKitCategory);

            var butaneTorchCategory = new Category {
                Name = "Butane Torch", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Categories.Add(butaneTorchCategory);

            var accessories3dCategory = new Category {
                Name = "3D Accessories", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Categories.Add(accessories3dCategory);

            #region Dremel Tools and Accessories defined

            var toolUS40_01 = new Tool
            {
                ToolId         = 92101,
                Name           = "Dremel US40 Ultra-Saw",
                ModelNumber    = "US40-01",
                MaterialNumber = string.Empty,
                DomainId       = DremelDataTenant.DomainId
            };
            jobContext.Tools.Add(toolUS40_01);

            var toolUS40_03 = new Tool
            {
                ToolId         = 92102,
                Name           = "Dremel US40 Ultra-Saw",
                ModelNumber    = "US40-03",
                MaterialNumber = string.Empty,
                DomainId       = DremelDataTenant.DomainId
            };
            jobContext.Tools.Add(toolUS40_03);

            var accessoryUS700 = new Accessory()
            {
                Name = "Dremel US700 Ultra-Saw 6-Piece Cutting Wheel Kit", ModelNumber = "US700", MaterialNumber = "B00JGB04RI ", DomainId = DremelDataTenant.DomainId
            };
            jobContext.Accessories.Add(accessoryUS700);

            sawsCategory.Tools = new List <Tool> {
                toolUS40_01, toolUS40_03
            };
            sawsCategory.Accessories = new List <Accessory>()
            {
                accessoryUS700
            };

            var savedCount = jobContext.SaveChanges();
            return(savedCount);

            #endregion
        }
Ejemplo n.º 14
0
        public static int SeedBoschDiyGreenToolsGraphData(JobAssistantContext jobContext)
        {
            #region Tenants defined

            jobContext.Tenants.AddRange(new List <Tenant> {
                BoschGreenDataTenant
            });
            jobContext.SaveChanges();

            #endregion

            #region Bosch Green Tools and Accessories defined

            var tool_IXO = new Tool()
            {
                ModelNumber    = "IXO",
                Name           = "Lithium-ion Cordless Screwdriver",
                Description    = string.Empty,
                DomainId       = BoschGreenDataTenant.DomainId,
                MaterialNumber = "06039A8000"
            };

            var tool_IXO_Family_Set = new Tool()
            {
                ModelNumber    = "IXO Family Set",
                Name           = "Lithium-ion Cordless Screwdriver",
                Description    = string.Empty,
                DomainId       = BoschGreenDataTenant.DomainId,
                MaterialNumber = "06039A800M"
            };

            var tool_PSRSelect = new Tool()
            {
                ModelNumber    = "PSR Select",
                Name           = "PSR Select Cordless Screwdriver",
                Description    = "One cordless screwdriver with nine adapters.",
                DomainId       = BoschGreenDataTenant.DomainId,
                MaterialNumber = "0603977000"
            };

            var tool_EasyDrill12 = new Tool()
            {
                ModelNumber    = "EasyDrill 12",
                Name           = "EasyDrill 12",
                Description    = "Compact Lithium-ion Cordless Drill/Driver",
                DomainId       = BoschGreenDataTenant.DomainId,
                MaterialNumber = "06039B3000"
            };

            var tool_EasyDrill1200 = new Tool()
            {
                ModelNumber    = "EasyDrill 1200",
                Name           = "EasyDrill 1200",
                Description    = "Lithium-ion Cordless Two-Speed Drill/Driver",
                DomainId       = BoschGreenDataTenant.DomainId,
                MaterialNumber = "06039A210B"
            };

            var tool_PSB1800 = new Tool
            {
                ModelNumber = "PSB 1800",
                Name        = "Bosch PSB 1800 LI-2 Lithium-ion Cordless Two-speed Combi",
                Description =
                    "Its low weight of 1.3 kilograms and compact dimensions make the PSB 1800 LI-2 from Bosch one of the handiest cordless combi drills of its kind. Thanks to its maximum torque of 38 newton metres, you can even drill and drive screws in hard materials without any problems.",
                DomainId = BoschGreenDataTenant.DomainId
            };

            var tool_EasyImpact12 = new Tool
            {
                ModelNumber = "EasyImpact 12",
                Name        = "EasyImpact 12 (1 battery pack)",
                Description =
                    "The EasyImpact 12 cordless 2-speed combi drill – the universal talent in the compact class",
                DomainId       = BoschGreenDataTenant.DomainId,
                MaterialNumber = "0603983974"
            };

            var tool_ImpactDrillPSB500RE = new Tool()
            {
                ModelNumber = "PSB 500",
                Name        = "PSB 500 RE Hammer Drill [Energy Class A]",
                Description = "The PSB 500 RE is a lightweight impact drill that provides unbeatable user comfort thanks to its powerful 500 watt motor.",
                DomainId    = BoschGreenDataTenant.DomainId,
            };

            var tool_ImpactDrillPSB750RE = new Tool()
            {
                ModelNumber = "PSB 750",
                Name        = "PSB 750 RE Hammer Drill",
                Description = "The PSB 750 RCE is a compact universal impact drill that makes drilling jobs in concrete, stone, wood and steel, even at large diameters, easy for DIYers.",
                DomainId    = BoschGreenDataTenant.DomainId,
            };

            var tool_ImpactDrillPSB850_2RE = new Tool()
            {
                ModelNumber = "PSB 850 RE",
                Name        = "PSB 850 RE Hammer Drill",
                Description = "The powerful and sturdy PSB 850-2 RE impact drill is suitable for the most demanding DIYers. This impact drill also comes with exceptionally stable and well insulated aluminium housing. The keyless chuck allows you to change drill bits rapidly and simply.",
                DomainId    = BoschGreenDataTenant.DomainId,
            };

            var tool_RotaryHammerPBH2100RE = new Tool()
            {
                ModelNumber = "PSB 2100 RE",
                Name        = "PSB 2100 RE Hammer Drill",
                Description = "The PBH 2100 RE rotary hammer from Bosch is a handy and powerful tool for all common hammering, drilling or chiselling jobs. A high impact force is provided by its 550 watts of power and its pneumatic Bosch hammer mechanism with a single impact energy of 1.7 joules.",
                DomainId    = BoschGreenDataTenant.DomainId,
            };

            var tool_JigsawPST650 = new Tool()
            {
                ModelNumber = "PST 650",
                Name        = "Easy Jigsaw PST 650",
                Description = "The Easy Jigsaw PST 650 from Bosch: Easy Rider – for precise curves and straight lines",
                DomainId    = BoschGreenDataTenant.DomainId,
            };
            var tool_Jigsaw_PST700E = new Tool()
            {
                ModelNumber = "PST 700E",
                Name        = "Easy Jigsaw PST 700 E",
                Description = "The Easy Jigsaw PST 700 E from Bosch: Easy Rider – for precise curves and straight lines",
                DomainId    = BoschGreenDataTenant.DomainId,
            };
            var tool_JigSawPST900PEL = new Tool()
            {
                ModelNumber = "PST 700 PEL",
                Name        = "The Expert Jigsaw PST 900 PEL",
                Description = "The Expert Jigsaw PST 900 PEL from Bosch: With maximum precision through all materials",
                DomainId    = BoschGreenDataTenant.DomainId,
            };

            var accessory_MiniXLineZ = new Accessory()
            {
                Name           = "Mini-X-Line drill bit set, spirit level, hand screwdriver",
                Description    = "Metal and masonry drill bit set, spirit level with screwdriver bits and hand screwdriver.",
                DomainId       = BoschGreenDataTenant.DomainId,
                MaterialNumber = "2607017200"
            };

            #endregion

            #region Bosch Green Jobs defined

            var screwDrivingJob = new Job
            {
                JobId    = 8100,
                Name     = "Screw-driving",
                DomainId = BoschGreenDataTenant.DomainId
            };
            var drillingAndChisellingJob = new Job
            {
                JobId    = 8101,
                Name     = "Drilling and Chi-selling",
                DomainId = BoschGreenDataTenant.DomainId
            };
            var drillingAndChisellingMortisingJob = new Job
            {
                JobId    = 8102,
                Name     = "Drilling, Chi-selling and Mortising",
                DomainId = BoschGreenDataTenant.DomainId
            };
            var sawingJob = new Job()
            {
                JobId    = 8103,
                Name     = "Sawing",
                DomainId = BoschGreenDataTenant.DomainId
            };
            var sandingJob = new Job()
            {
                JobId    = 8104,
                Name     = "Sanding Wood Surfaces",
                DomainId = BoschGreenDataTenant.DomainId
            };
            var gridingAndCuttingJob = new Job()
            {
                JobId    = 8105,
                Name     = "Grinding and Cutting Metal",
                DomainId = BoschGreenDataTenant.DomainId
            };

            var plantingAndRoutingJob = new Job()
            {
                JobId    = 8106,
                Name     = "Planting and Routing",
                DomainId = BoschGreenDataTenant.DomainId
            };

            var measuringAndLevelingJob = new Job()
            {
                JobId    = 8107,
                Name     = "Measuring, Leveling and Detecting",
                DomainId = BoschGreenDataTenant.DomainId
            };

            var paintingJob = new Job()
            {
                JobId    = 8108,
                Name     = "Working with Paint and Wallpaper",
                DomainId = BoschGreenDataTenant.DomainId
            };

            var craftingJob = new Job()
            {
                JobId    = 8109,
                Name     = "Crafting, Repairing and Cleaning, Decorating",
                DomainId = BoschGreenDataTenant.DomainId
            };

            var layingTilesJob = new Job()
            {
                JobId    = 8110,
                Name     = "Laying Tiles",
                DomainId = BoschGreenDataTenant.DomainId
            };

            var layingFloorJob = new Job()
            {
                JobId    = 8111,
                Name     = "Laying a Floor",
                DomainId = BoschGreenDataTenant.DomainId
            };

            jobContext.Jobs.AddRange(new List <Job>
            {
                screwDrivingJob,
                drillingAndChisellingJob,
                drillingAndChisellingMortisingJob,
                sawingJob,
                sandingJob,
                gridingAndCuttingJob,
                plantingAndRoutingJob,
                measuringAndLevelingJob,
                paintingJob,
                craftingJob,
                layingTilesJob,
                layingFloorJob
            });

            #endregion

            var easyMaterialForScrewDriving = new Material()
            {
                Name = "Easy Material", Tools = new List <Tool>(), DomainId = BoschGreenDataTenant.DomainId
            };
            easyMaterialForScrewDriving.Tools.Add(tool_IXO);
            easyMaterialForScrewDriving.Tools.Add(tool_EasyImpact12);
            easyMaterialForScrewDriving.Tools.Add(tool_ImpactDrillPSB500RE);

            var mediumMaterialForScrewDriving = new Material()
            {
                Name = "Medium Material", Tools = new List <Tool>(), DomainId = BoschGreenDataTenant.DomainId
            };
            mediumMaterialForScrewDriving.Tools.Add(tool_ImpactDrillPSB750RE);

            var hardMaterialForScrewDriving = new Material()
            {
                Name = "Hard Material", Tools = new List <Tool>(), DomainId = BoschGreenDataTenant.DomainId
            };
            hardMaterialForScrewDriving.Tools.Add(tool_ImpactDrillPSB850_2RE);

            screwDrivingJob.Materials = new List <Material> {
                easyMaterialForScrewDriving, mediumMaterialForScrewDriving, hardMaterialForScrewDriving
            };

            var easyMaterialDrillingAndChiselling = new Material()
            {
                Name = "Easy Material", Tools = new List <Tool>(), DomainId = BoschGreenDataTenant.DomainId
            };
            easyMaterialDrillingAndChiselling.Tools.Add(tool_ImpactDrillPSB500RE);

            var mediumMaterialDrillingAndChiselling = new Material()
            {
                Name = "Medium Material", Tools = new List <Tool>(), DomainId = BoschGreenDataTenant.DomainId
            };
            mediumMaterialDrillingAndChiselling.Tools.Add(tool_ImpactDrillPSB750RE);
            drillingAndChisellingJob.Materials = new List <Material>
            {
                mediumMaterialDrillingAndChiselling
            };

            var hardMaterialDrillingAndChiselling = new Material()
            {
                Name = "Hard Material", Tools = new List <Tool>(), DomainId = BoschGreenDataTenant.DomainId
            };
            hardMaterialDrillingAndChiselling.Tools.Add(tool_ImpactDrillPSB850_2RE);

            drillingAndChisellingJob.Materials = new List <Material> {
                easyMaterialDrillingAndChiselling, mediumMaterialDrillingAndChiselling, hardMaterialDrillingAndChiselling
            };

            var easyMaterialForDrillingChisellingAndMortising = new Material()
            {
                Name = "Medium Material", Tools = new List <Tool>(), DomainId = BoschGreenDataTenant.DomainId
            };
            easyMaterialForDrillingChisellingAndMortising.Tools.Add(tool_RotaryHammerPBH2100RE);

            drillingAndChisellingMortisingJob.Materials = new List <Material>()
            {
                easyMaterialForDrillingChisellingAndMortising
            };

            // Create materials and associate sample tools to material(s).
            //
            var easyMaterialForSawing = new Material {
                Name = "Easy Material", Tools = new List <Tool> {
                    tool_JigsawPST650, tool_Jigsaw_PST700E
                }, DomainId = BoschGreenDataTenant.DomainId
            };
            var hardMaterialForSawing = new Material()
            {
                Name = "Hard Material", Tools = new List <Tool> {
                    tool_JigSawPST900PEL
                }, DomainId = BoschGreenDataTenant.DomainId
            };

            sawingJob.Materials = new List <Material>()
            {
                easyMaterialForSawing, hardMaterialForSawing
            };

            // Create materials and associate sample tools to material(s).
            //
            sandingJob.Materials = new List <Material>();

            // Create materials and associate sample tools to material(s).
            //
            gridingAndCuttingJob.Materials = new List <Material>();

            // Create materials and associate sample tools to material(s).
            //
            plantingAndRoutingJob.Materials = new List <Material>();

            // Create materials and associate sample tools to material(s).
            //
            measuringAndLevelingJob.Materials = new List <Material>();

            // Create materials and associate sample tools to material(s).
            //
            paintingJob.Materials = new List <Material>();

            // Create materials and associate sample tools to material(s).
            //
            craftingJob.Materials = new List <Material>();

            // Create materials and associate sample tools to material(s).
            //
            layingTilesJob.Materials = new List <Material>();

            // Create materials and associate sample tools to material(s).
            //
            layingFloorJob.Materials = new List <Material>();

            /***
             * Using the ".Materials" collection, ADD associate materials for the job.
             * Then, using the ".Tools" collection, ADD tools and associate materials for other jobs including:
             *
             *  drillingAndChisellingMortisingJob,
             *  sawingJob,
             *  sandingJob,
             *  gridingAndCuttingJob,
             *  plantingAndRoutingJob,
             *  measuringAndLevelingJob,
             *  paintingJob,
             *  craftingJob,
             *  layingTilesJob,
             *  layingFloorJob
             */

            var cordlessToolsCategory = new Category
            {
                Name     = "Bosch - Cordless Tools Cordless Tools",
                DomainId = BoschGreenDataTenant.DomainId
            };
            jobContext.Categories.Add(cordlessToolsCategory);

            var impactDrillsCategory = new Category {
                Name = "Impact Drills", DomainId = BoschGreenDataTenant.DomainId
            };
            jobContext.Categories.Add(impactDrillsCategory);

            var rotaryHammersCategory =
                new Category {
                Name = "Rotary hammers", DomainId = BoschGreenDataTenant.DomainId
            };
            jobContext.Categories.Add(rotaryHammersCategory);

            var sawsCategory = new Category {
                Name = "Saws", DomainId = BoschGreenDataTenant.DomainId
            };
            jobContext.Categories.Add(sawsCategory);

            var benchtopToolsCategory =
                new Category {
                Name = "Benchtop tools", DomainId = BoschGreenDataTenant.DomainId
            };
            jobContext.Categories.Add(benchtopToolsCategory);

            cordlessToolsCategory.Tools = new List <Tool> {
                tool_IXO, tool_IXO_Family_Set, tool_PSRSelect, tool_EasyDrill12, tool_EasyDrill1200, tool_PSB1800
            };
            cordlessToolsCategory.Accessories = new List <Accessory> {
                accessory_MiniXLineZ
            };

            var savedCount = jobContext.SaveChanges();
            return(savedCount);
        }