public void ComparingEntitiesWithCompoundID_ToConstant () { var someEntity = new Knife { ID = new MetaID (0, "C0") }; CheckQuery ( from k in Knives where k == someEntity select k.ID, "SELECT [t0].[ID] AS [Value],[t0].[ClassID] AS [ClassID] FROM [KnifeTable] AS [t0] " + "WHERE (([t0].[ID] = @1) AND ([t0].[ClassID] = @2))", new CommandParameter ("@1", 0), new CommandParameter ("@2", "C0")); CheckQuery ( from k in Knives where k != someEntity select k.ID, "SELECT [t0].[ID] AS [Value],[t0].[ClassID] AS [ClassID] FROM [KnifeTable] AS [t0] " + "WHERE (([t0].[ID] <> @1) OR ([t0].[ClassID] <> @2))", new CommandParameter ("@1", 0), new CommandParameter ("@2", "C0")); }
private static IEnumerable<object> GetSampleDataEntities () { var company1 = new Company { ID = 1, MainRestaurant = null, MainKitchen = null, DateOfIncorporation = new DateTime (2001, 01, 13)}; var company2 = new Company { ID = 2, MainRestaurant = null, MainKitchen = null, DateOfIncorporation = new DateTime (1886, 02, 20) }; var restaurant1 = new Restaurant { ID = 1, CompanyIfAny = company1}; company1.MainRestaurant = restaurant1; var restaurant2 = new Restaurant { ID = 2 }; company2.MainRestaurant = restaurant2; var kitchen1 = new Kitchen { ID = 1, Name = "Jamie's Kitchen", Cook = null, LastCleaningDay = new DateTime (2012, 5, 13), LastInspectionScore = 80, PassedLastInspection = true, Restaurant = restaurant1, RoomNumber = 17 }; company1.MainKitchen = kitchen1; var kitchen2 = new Kitchen { ID = 2, Name = "Perfumerie", Cook = null, LastCleaningDay = null, LastInspectionScore = null, PassedLastInspection = null, Restaurant = restaurant1, RoomNumber = 1 }; var kitchen3 = new Kitchen { ID = 3, Name = "Bocuse's Kitchen", Cook = null, LastCleaningDay = DateTime.Today, LastInspectionScore = 100, PassedLastInspection = true, Restaurant = restaurant2, RoomNumber = 2 }; company2.MainKitchen = kitchen3; var knife1 = new Knife { ID = new MetaID (1, "KnifeClass"), Sharpness = 10.0 }; var cook1 = new Cook { ID = 1, FirstName = "Peter Paul", Name = "Rubens", IsStarredCook = false, IsFullTimeCook = false, Substitution = null, Kitchen = null, KnifeID = knife1.ID, Knife = knife1 }; var knife2 = new Knife { ID = new MetaID (2, "DerivedKnifeClass"), Sharpness = 5.0 }; var cook2 = new Cook { ID = 2, FirstName = "Jamie", Name = "Oliver", IsStarredCook = true, IsFullTimeCook = false, Substitution = null, Kitchen = kitchen1, KnifeID = knife2.ID, Knife = knife2 }; kitchen1.Cook = cook2; var cook3 = new Cook { ID = 3, FirstName = "Hugo", Name = "Boss", IsStarredCook = false, IsFullTimeCook = true, Substitution = cook1, Kitchen = kitchen2 }; cook1.Substituted = cook3; kitchen2.Cook = cook3; var chef1 = new Chef { ID = 4, FirstName = "Paul", Name = "Bocuse", IsStarredCook = true, IsFullTimeCook = false, Substitution = cook1, Kitchen = kitchen3, LetterOfRecommendation = "A really great chef!" }; cook1.Substituted = chef1; kitchen3.Cook = chef1; var chef2 = new Chef { ID = 5, FirstName = "Caul", Name = "Bopuse", IsStarredCook = false, IsFullTimeCook = true, Substitution = cook2, Kitchen = null, LetterOfRecommendation = null }; cook2.Substituted = chef2; return new object[] { company1, company2, restaurant1, restaurant2, kitchen1, kitchen2, kitchen3, chef1, chef2, knife1, knife2, cook1, cook2, cook3 }; }