Exemplo n.º 1
0
        public void ShouldBeBrokenInMemoryProviderFK(string caseName, DbContextOptions options)
        {
            var meeting = GetOriginalMeetingfromJson();

            using (var context = new MeetingContext(options))
            {
                ClearTestDb(context);

                strategy.SaveMeeting(context, meeting);
                context.SaveChanges();

                Assert.True(meeting.Id > 0);

                var race = meeting.Races.First();
                context.Attach(race);
                race.MeetingId = 5000;
                var ex = Record.Exception(() => context.SaveChanges());
                Assert.IsType <DbUpdateException>(ex);
                Assert.Contains("FOREIGN KEY", ex.InnerException.Message);
            }
        }