示例#1
0
        public async Task Using_a_conflicting_incompatible_id_throws()
        {
            var options = Fixture.CreateOptions();

            using var context = new ConflictingIncompatibleIdContext(options);
            await Assert.ThrowsAnyAsync <Exception>(
                async() =>
            {
                await context.Database.EnsureCreatedAsync();

                context.Add(new ConflictingIncompatibleId {
                    id = 42
                });

                await context.SaveChangesAsync();
            });
        }
        public async Task Using_a_conflicting_incompatible_id_throws()
        {
            await using var testDatabase = CosmosTestStore.CreateInitialized(DatabaseName);
            var options = Fixture.CreateOptions(testDatabase);

            using (var context = new ConflictingIncompatibleIdContext(options))
            {
                await Assert.ThrowsAnyAsync <Exception>(
                    async() =>
                {
                    await context.Database.EnsureCreatedAsync();

                    context.Add(new ConflictingIncompatibleId {
                        id = 42
                    });

                    await context.SaveChangesAsync();
                });
            }
        }