public void NotAllowDuplication() { var settings = new PersistenceConversationalAttribute(); var classDef = new ConversationalMetaInfoHolder(typeof(Sample), settings); var classDefDup = new ConversationalMetaInfoHolder(typeof(Sample), settings); var store = new ConversationalMetaInfoStore(); store.AddMetadata(classDef); Assert.Throws <ArgumentException>(() => store.AddMetadata(classDefDup)); }
public void ShouldWork() { var settings = new PersistenceConversationalAttribute(); var classDef = new ConversationalMetaInfoHolder(typeof(Sample), settings); var store = new ConversationalMetaInfoStore(); store.AddMetadata(classDef); store.MetaData.Should().Not.Be.Empty(); store.MetaData.Should().Contain(classDef); store.GetMetadataFor(typeof(Sample)).Should().Be.SameInstanceAs(classDef); }
public void PropertiesDefault() { var settings = new PersistenceConversationalAttribute(); var classDef = new ConversationalMetaInfoHolder(typeof(Sample), settings); classDef.ConversationalClass.Should().Be.EqualTo(typeof(Sample)); classDef.Setting.Should().Be.SameInstanceAs(settings); classDef.Methods.Should().Be.Empty(); Assert.That(!classDef.Contains(Reflector.MethodInfo <object>(o => o.GetHashCode()))); }
public void CTorProtection() { Assert.Throws <ArgumentNullException>(() => new ConversationalMetaInfoHolder(null, null)) .ParamName.Should().Be.EqualTo("conversationalClass"); Assert.Throws <ArgumentNullException>(() => new ConversationalMetaInfoHolder(typeof(object), null)) .ParamName.Should().Be.EqualTo("setting"); var settings = new PersistenceConversationalAttribute(); Assert.Throws <ArgumentNullException>(() => new ConversationalMetaInfoHolder(null, settings)) .ParamName.Should().Be.EqualTo("conversationalClass"); }
public void ShouldWorkWithDefaultValues() { // This test is useful to check future Breaking-changes var a = new PersistenceConversationalAttribute(); Assert.That(a.ConversationCreationInterceptor, Is.Null); Assert.That(a.ConversationId, Is.Null); Assert.That(a.DefaultEndMode, Is.EqualTo(EndMode.Continue)); Assert.That(a.IdPrefix, Is.Null); Assert.That(a.MethodsIncludeMode, Is.EqualTo(MethodsIncludeMode.Implicit)); Assert.That(a.UseConversationCreationInterceptorConvention, Is.True); Assert.That(a.AllowOutsidePersistentCall, Is.False); }
private static ConversationalMetaInfoHolder CreateNewSampleDef() { var settings = new PersistenceConversationalAttribute(); return(new ConversationalMetaInfoHolder(typeof(Sample), settings)); }