public void WhenSettingUpTheHasManyConvention() { // Arrange IHasManyConvention subject = new CascadeConvention(); var collectionCascadeInstanceMock = new Mock <ICollectionCascadeInstance>(); var oneToManyCollectionInstanceMock = new Mock <IOneToManyCollectionInstance>(); oneToManyCollectionInstanceMock.SetupGet(otm => otm.Cascade).Returns(collectionCascadeInstanceMock.Object); // Act subject.Apply(oneToManyCollectionInstanceMock.Object); // Assert oneToManyCollectionInstanceMock.Verify(otm => otm.Inverse()); collectionCascadeInstanceMock.Verify(cc => cc.All()); }
public void WhenSettingUpTheReferenceConventionWithoutOverridingColumnNameGetting() { // Arrange IReferenceConvention subject = new CascadeConvention(); var name = AutoFixture.Create <string>(); var cascadeInstanceMock = new Mock <ICascadeInstance>(); var manyToOneInstanceMock = new Mock <IManyToOneInstance>(); manyToOneInstanceMock.SetupGet(mto => mto.Cascade).Returns(cascadeInstanceMock.Object); manyToOneInstanceMock.SetupGet(mto => mto.Name).Returns(name); // Act subject.Apply(manyToOneInstanceMock.Object); // Assert manyToOneInstanceMock.Verify(mto => mto.Column($"{name}Id"), Times.Once()); cascadeInstanceMock.Verify(cascade => cascade.All(), Times.Once()); }