public void OneTwoManyAssociationSave() { var parent = new AggregationEntity { Name = "Parent" }; for (int i = 0; i < 10; i++) { var child = new AggregationEntity { Name = string.Format("child {0}", i), OneToMany = parent }; parent.ManyToOne.Add(child); } this.AggregationEntitiesRepositary.Save(parent); this.AggregationEntitiesRepositary.MemoryBuffer.Should().HaveCount(11); this.AggregationEntitiesRepositary.MemoryBuffer.Should().Contain(parent); this.AggregationEntitiesRepositary.MemoryBuffer.Should().Contain(parent.ManyToOne); }
public void DeleteConnectedEntities() { var aggregationEntity = new AggregationEntity { Name = "Awesome aggregation" }; aggregationEntity.OneToOne = new SimpleEntity { Name = "Awesome string" }; this.AggregationEntitiesRepositary.Save(aggregationEntity); this.SimpleEntitiesRepositary.Remove(aggregationEntity.OneToOne); this.AggregationEntitiesRepositary.MemoryBuffer.Should().HaveCount(1); this.AggregationEntitiesRepositary.MemoryBuffer.Should().Contain(aggregationEntity); this.SimpleEntitiesRepositary.MemoryBuffer.Should().HaveCount(0); }