public void Generic_UseWithArgs_ReturnsTypeBuilder() { EngineConfigurationTypeBuilder<SimpleUser> configuration = new EngineConfigurationTypeBuilder<SimpleUser>(); EngineConfigurationTypeMemberBuilder<SimpleUser, string> propertyConfiguration = new EngineConfigurationTypeMemberBuilder<SimpleUser, string>(null, configuration); IEngineConfigurationTypeBuilder<SimpleUser> returnedConfiguration = propertyConfiguration.Use<SimpleDataSource>(0,1,10); Assert.AreEqual(configuration, returnedConfiguration); }
public void Generic_Default_ReturnsTypeBuilder() { EngineConfigurationTypeBuilder<SimpleUser> configuration = new EngineConfigurationTypeBuilder<SimpleUser>(); EngineConfigurationTypeMemberBuilder<SimpleUser, string> propertyConfiguration = new EngineConfigurationTypeMemberBuilder<SimpleUser, string>(null, configuration); IEngineConfigurationTypeBuilder<SimpleUser> returnedConfiguration = propertyConfiguration.Default(); Assert.AreEqual(configuration, returnedConfiguration); }
public void Generic_Default_ResetsSource() { EngineConfigurationTypeBuilder<SimpleUser> configuration = new EngineConfigurationTypeBuilder<SimpleUser>(); EngineConfigurationTypeMemberBuilder<SimpleUser, string> propertyConfiguration = new EngineConfigurationTypeMemberBuilder<SimpleUser, string>(null, configuration); propertyConfiguration.Use<SimpleDataSource>(); propertyConfiguration.Default(); Assert.AreEqual(0, propertyConfiguration.GetDatasources().Count()); }
public IEngineConfigurationTypeBuilder Include(Type t) { // Create the configuration var configuration = new EngineConfigurationTypeBuilder(t); // Store it locally mTypes.Add(configuration); //And return the public interface return(configuration); }
public void Generic_GetConfigurationMember_ReturnsConfigurationMember() { EngineConfigurationTypeBuilder<SimpleUser> configuration = new EngineConfigurationTypeBuilder<SimpleUser>(); EngineTypeMember member = ReflectionHelper.GetMember<SimpleUser>(x => x.EmailAddress); EngineConfigurationTypeMemberBuilder<SimpleUser, string> propertyConfiguration = new EngineConfigurationTypeMemberBuilder<SimpleUser, string>( member, configuration); EngineTypeMember returnMember = propertyConfiguration.GetConfigurationMember(); Assert.AreEqual(member, returnMember); }
public void Generic_GetConfigurationAction_Invalid_ReturnsNULL() { EngineConfigurationTypeBuilder<SimpleUser> configuration = new EngineConfigurationTypeBuilder<SimpleUser>(); EngineTypeMember member = ReflectionHelper.GetMember<SimpleUser>(x => x.EmailAddress); EngineConfigurationTypeMemberBuilder<SimpleUser, string> propertyConfiguration = new EngineConfigurationTypeMemberBuilder<SimpleUser, string>( member, configuration); IEngineConfigurationDatasource returnAction = propertyConfiguration.GetDatasources().FirstOrDefault(); Assert.Null(returnAction); }
public EngineConfigurationTypeMemberBuilder(EngineTypeMember member, EngineConfigurationTypeBuilder parentConfiguration) { mMember = member; mParentConfiguration = parentConfiguration; }
public EngineConfigurationTypeMemberBuilder(EngineTypeMember member, EngineConfigurationTypeBuilder <TPoco> parentConfiguration) : base(member, parentConfiguration) { mParentConfiguration = parentConfiguration; }
public void NotGeneric_Use_ReturnsTypeBuilder() { EngineConfigurationTypeBuilder configuration = new EngineConfigurationTypeBuilder(typeof(SimpleUser)); EngineConfigurationTypeMemberBuilder propertyConfiguration = new EngineConfigurationTypeMemberBuilder(null, configuration); IEngineConfigurationTypeBuilder returnedConfiguration = propertyConfiguration.Use(typeof(SimpleDataSource)); Assert.AreEqual(configuration, returnedConfiguration); }
public void NotGeneric_UseInvalidDataSource_ThrowsArgumentException() { EngineConfigurationTypeBuilder configuration = new EngineConfigurationTypeBuilder(typeof(SimpleUser)); EngineConfigurationTypeMemberBuilder propertyConfiguration = new EngineConfigurationTypeMemberBuilder(null, configuration); Assert.Throws<ArgumentException>(() => { propertyConfiguration.Use(typeof(SimpleUser)); }); }
public void NotGeneric_Default_ResetsSource() { EngineConfigurationTypeBuilder configuration = new EngineConfigurationTypeBuilder(typeof(SimpleUser)); EngineConfigurationTypeMemberBuilder propertyConfiguration = new EngineConfigurationTypeMemberBuilder(null, configuration); propertyConfiguration.Use(typeof(SimpleDataSource)); propertyConfiguration.Default(); Assert.AreEqual(0, propertyConfiguration.GetDatasources().Count()); }