public void Attaching_one_to_one_aggregate_with_no_key_set_adds_it_instead() { using var context = new AggregateContext(); var statistics = new BlogCategoryStatistics(); var category = new BlogCategory { Statistics = statistics }; context.Attach(category); Assert.Equal(EntityState.Added, context.Entry(category).State); Assert.Equal(EntityState.Added, context.Entry(category.Statistics).State); }
public void Can_add_one_to_one_aggregate() { using var context = new AggregateContext(); var statistics = new BlogCategoryStatistics(); var category = new BlogCategory { Statistics = statistics }; context.Add(category); Assert.Equal(EntityState.Added, context.Entry(category).State); Assert.Equal(EntityState.Added, context.Entry(category.Statistics).State); }
public void Can_attach_one_to_one_aggreate() { using (var context = new AggregateContext()) { var statistics = new BlogCategoryStatistics { Id = 11, BlogCategoryId = 22 }; var category = new BlogCategory { Id = 22, Statistics = statistics }; context.Attach(category); Assert.Equal(EntityState.Unchanged, context.Entry(category).State); Assert.Equal(EntityState.Unchanged, context.Entry(category.Statistics).State); } }
public void Can_add_one_to_one_aggreate() { using (var context = new AggregateContext()) { var statistics = new BlogCategoryStatistics(); var category = new BlogCategory { Statistics = statistics }; context.Add(category); Assert.Equal(EntityState.Added, context.Entry(category).State); Assert.Equal(EntityState.Added, context.Entry(category.Statistics).State); } }
public void Can_attach_one_to_one_aggregate() { using var context = new AggregateContext(); var statistics = new BlogCategoryStatistics { Id = 11, BlogCategoryId = 22 }; var category = new BlogCategory { Id = 22, Statistics = statistics }; context.Attach(category); Assert.Equal(EntityState.Unchanged, context.Entry(category).State); Assert.Equal(EntityState.Unchanged, context.Entry(category.Statistics).State); }
public void One_to_one_dependents_with_no_key_set_are_added() { using var context = new AggregateContext(); var statistics = new BlogCategoryStatistics { BlogCategoryId = 22 }; var category = new BlogCategory { Id = 22, Statistics = statistics }; context.Attach(category); Assert.Equal(EntityState.Unchanged, context.Entry(category).State); Assert.Equal(EntityState.Added, context.Entry(category.Statistics).State); }
public void One_to_one_dependents_with_no_key_set_are_added() { using (var context = new AggregateContext()) { var statistics = new BlogCategoryStatistics { BlogCategoryId = 22 }; var category = new BlogCategory { Id = 22, Statistics = statistics }; context.Attach(category); Assert.Equal(EntityState.Unchanged, context.Entry(category).State); Assert.Equal(EntityState.Added, context.Entry(category.Statistics).State); } }
public void Attaching_one_to_one_aggregate_with_no_key_set_adds_it_instead() { using (var context = new AggregateContext()) { var statistics = new BlogCategoryStatistics(); var category = new BlogCategory { Statistics = statistics }; context.Attach(category); Assert.Equal(EntityState.Added, context.Entry(category).State); Assert.Equal(EntityState.Added, context.Entry(category.Statistics).State); } }