public void TimeStamp_Selector_Matches_Valid_Names() { var timeStampSelector = new TimeStampSelector(); var timeStampTestClass = new TimeStampTestClass(); //Iterate over all of the properties in the EmailTestClass object... foreach (var property in timeStampTestClass.GetType().GetProperties()) { var canBind = timeStampSelector.CanBind(property); Assert.IsTrue(canBind, string.Format("{0} should have been a valid match", property.Name)); } }
public void Should_Add_Type_Selectors_For_Multiple_Types_To_TypeTable() { //Create a new TypeTable var table = new TypeTable(false); //Create some string selectors that we're going to add var stringSelector1 = new StringSelector(); //Create some long selectors that we're going to use... var longSelector1 = new LongSelector(); var longSelector2 = new TimeStampSelector(); Assert.AreEqual(0, table.CountSelectors <string>(), "should have ZERO type selectors for type 'string' since we haven't added any yet"); Assert.AreEqual(0, table.CountSelectors <long>(), "should have ZERO type selectors for type 'long' since we haven't added any yet"); //Add the first and only string selector (our default string selector) table.AddSelector <string>(stringSelector1); Assert.AreEqual(1, table.CountSelectors <string>(), "should have ONE type selectors for type 'string'"); Assert.AreEqual(0, table.CountSelectors <long>(), "should have ZERO type selectors for type 'long' since we haven't added any yet"); //Assert that we haven't added any long selectors yet var firstStringSelector = table.GetSelectors <string>().First(); Assert.IsInstanceOf <StringSelector>(firstStringSelector); var currentLongSelector = table.GetSelectors <long>().FirstOrDefault(); Assert.IsNull(currentLongSelector); //Since we haven't added any long selectors yet, this should return null //Add the first long selector (our default long selector) table.AddSelector <long>(longSelector1); Assert.AreEqual(1, table.CountSelectors <string>(), "should have ONE type selectors for type 'string'"); Assert.AreEqual(1, table.CountSelectors <long>(), "should have ONE type selectors for type 'long'"); firstStringSelector = table.GetSelectors <string>().First(); Assert.IsInstanceOf <StringSelector>(firstStringSelector); currentLongSelector = table.GetSelectors <long>().FirstOrDefault(); Assert.IsInstanceOf <LongSelector>(currentLongSelector); //Add the final long selector (our timestamp selector) table.AddSelector <long>(longSelector2); Assert.AreEqual(1, table.CountSelectors <string>(), "should have ONE type selectors for type 'string'"); Assert.AreEqual(2, table.CountSelectors <long>(), "should have TWO type selectors for type 'long'"); firstStringSelector = table.GetSelectors <string>().First(); Assert.IsInstanceOf <StringSelector>(firstStringSelector); currentLongSelector = table.GetSelectors <long>().FirstOrDefault(); Assert.IsInstanceOf <TimeStampSelector>(currentLongSelector); }
public void Should_Add_Type_Selectors_For_Multiple_Types_To_TypeTable() { //Create a new TypeTable var table = new TypeTable(false); //Create some string selectors that we're going to add var stringSelector1 = new StringSelector(); //Create some long selectors that we're going to use... var longSelector1 = new LongSelector(); var longSelector2 = new TimeStampSelector(); Assert.AreEqual(0, table.CountSelectors<string>(), "should have ZERO type selectors for type 'string' since we haven't added any yet"); Assert.AreEqual(0, table.CountSelectors<long>(), "should have ZERO type selectors for type 'long' since we haven't added any yet"); //Add the first and only string selector (our default string selector) table.AddSelector<string>(stringSelector1); Assert.AreEqual(1, table.CountSelectors<string>(), "should have ONE type selectors for type 'string'"); Assert.AreEqual(0, table.CountSelectors<long>(), "should have ZERO type selectors for type 'long' since we haven't added any yet"); //Assert that we haven't added any long selectors yet var firstStringSelector = table.GetSelectors<string>().First(); Assert.IsInstanceOf<StringSelector>(firstStringSelector); var currentLongSelector = table.GetSelectors<long>().FirstOrDefault(); Assert.IsNull(currentLongSelector); //Since we haven't added any long selectors yet, this should return null //Add the first long selector (our default long selector) table.AddSelector<long>(longSelector1); Assert.AreEqual(1, table.CountSelectors<string>(), "should have ONE type selectors for type 'string'"); Assert.AreEqual(1, table.CountSelectors<long>(), "should have ONE type selectors for type 'long'"); firstStringSelector = table.GetSelectors<string>().First(); Assert.IsInstanceOf<StringSelector>(firstStringSelector); currentLongSelector = table.GetSelectors<long>().FirstOrDefault(); Assert.IsInstanceOf<LongSelector>(currentLongSelector); //Add the final long selector (our timestamp selector) table.AddSelector<long>(longSelector2); Assert.AreEqual(1, table.CountSelectors<string>(), "should have ONE type selectors for type 'string'"); Assert.AreEqual(2, table.CountSelectors<long>(), "should have TWO type selectors for type 'long'"); firstStringSelector = table.GetSelectors<string>().First(); Assert.IsInstanceOf<StringSelector>(firstStringSelector); currentLongSelector = table.GetSelectors<long>().FirstOrDefault(); Assert.IsInstanceOf<TimeStampSelector>(currentLongSelector); }
public void TimeStamp_Selector_Injects_All_TimeStamp_Values() { var timeStampSelector = new TimeStampSelector(); var timeStampTestClass = new TimeStampTestClass(); //Iterate over all of the properties in the fullNameClass object... foreach (var property in timeStampTestClass.GetType().GetProperties()) { //Inject the value into the property timeStampSelector.Generate(timeStampTestClass, property); } //Iterate over all of the properties again foreach (var property in timeStampTestClass.GetType().GetProperties()) { var fieldValue = (long)property.GetValue(timeStampTestClass, null); Assert.IsAssignableFrom <long>(fieldValue, "Should be type of long..."); Assert.AreNotEqual(fieldValue, default(long)); } }
public void TimeStamp_Selector_Injects_All_TimeStamp_Values() { var timeStampSelector = new TimeStampSelector(); var timeStampTestClass = new TimeStampTestClass(); //Iterate over all of the properties in the fullNameClass object... foreach (var property in timeStampTestClass.GetType().GetProperties()) { //Inject the value into the property timeStampSelector.Generate(timeStampTestClass, property); } //Iterate over all of the properties again foreach (var property in timeStampTestClass.GetType().GetProperties()) { var fieldValue = (long)property.GetValue(timeStampTestClass, null); Assert.IsAssignableFrom<long>(fieldValue, "Should be type of long..."); Assert.AreNotEqual(fieldValue, default(long)); } }
public void TimeStamp_Selector_Matches_Valid_Names() { var timeStampSelector = new TimeStampSelector(); var timeStampTestClass = new TimeStampTestClass(); //Iterate over all of the properties in the EmailTestClass object... foreach (var property in timeStampTestClass.GetType().GetProperties()) { var canBind = timeStampSelector.CanBind(property); Assert.IsTrue(canBind, string.Format("{0} should have been a valid match", property.Name)); } }