public void ZeroShouldNotMatchNullWhenSelectNotExisting()
        {
            using (var db = new UnitTestContext())
            {
                db.Prices.Add(new Price()
                {
                    Date = new DateTime(2019, 1, 1), Name = "ERICB", Value = 80
                });
                db.Prices.Add(new Price()
                {
                    Date = new DateTime(2019, 1, 2), Name = "ERICB", Value = 81
                });
                db.Prices.Add(new Price()
                {
                    Date = new DateTime(2019, 1, 3), Name = "ERICB", Value = 82
                });
                db.Prices.Add(new Price()
                {
                    Date = new DateTime(2019, 1, 4), Name = "ERICB", Value = 0
                });
                db.Prices.Add(new Price()
                {
                    Date = new DateTime(2019, 1, 5), Name = "ERICB", Value = 86
                });
                db.SaveChanges();

                var prices = new[]
                {
                    db.Prices.Add(new Price()
                    {
                        Date = new DateTime(2019, 1, 1), Name = "ERICB", Value = 80
                    }),
                    db.Prices.Add(new Price()
                    {
                        Date = new DateTime(2019, 1, 2), Name = "ERICB", Value = 81
                    }),
                    db.Prices.Add(new Price()
                    {
                        Date = new DateTime(2019, 1, 3), Name = "ERICB", Value = 82
                    }),
                    db.Prices.Add(new Price()
                    {
                        Date = new DateTime(2019, 1, 4), Name = "ERICB", Value = null
                    }),
                    db.Prices.Add(new Price()
                    {
                        Date = new DateTime(2019, 1, 5), Name = "ERICB", Value = 86
                    })
                };
                var existing = db.BulkSelectNotExisting <Price, Price>(
                    new BulkSelectRequest <Price>(new[] { "Date", "Name", "Value" }, prices));
                Assert.AreEqual(1, existing.Count);
                Assert.AreSame(prices[3], existing[0]);
            }
        }
        public void SelectNotExistingFromTableWithUserGeneratedGuidAsPrimaryKeyShouldWork()
        {
            using (var db = new UnitTestContext())
            {
                var teams = new List <TeamWithUserGeneratedGuidKey>();

                // Add ten teams to the database (Team 0 - Team 9)
                for (int i = 0; i < 10; i++)
                {
                    teams.Add(new TeamWithUserGeneratedGuidKey()
                    {
                        Id = Guid.NewGuid(), Name = $"Team #{i}"
                    });
                }

                // Save the ten first teams to the database.
                db.BulkInsertAll(new BulkInsertRequest <TeamWithUserGeneratedGuidKey>
                {
                    Entities = teams
                });

                // Add another ten teams (Team 10 - Team 19) to
                // the list but not to the database.
                for (int i = 10; i < 20; i++)
                {
                    teams.Add(new TeamWithUserGeneratedGuidKey()
                    {
                        Id = Guid.NewGuid(), Name = $"Team #{i}"
                    });
                }

                // The only teams we should get back out of the 20 teams (Team 0 - Team 19)
                // are the last ten that we did not save to the database.
                var existingTeams = db.BulkSelectNotExisting <TeamWithUserGeneratedGuidKey, TeamWithUserGeneratedGuidKey>(new BulkSelectRequest <TeamWithUserGeneratedGuidKey>(new[] { "Id" }, teams));
                Assert.AreEqual(10, existingTeams.Count);
                for (int i = 0; i < 10; i++)
                {
                    Assert.AreEqual(teams[i + 10].Id, existingTeams[i].Id);
                    Assert.AreEqual(teams[i + 10].Name, existingTeams[i].Name);
                }
            }
        }