Exemplo n.º 1
0
 public void Test_IResolvableToValueDateTime()
 {
     //---------------Set up test pack-------------------
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     DateTimeToday dateTimeToday = new DateTimeToday();
     //---------------Test Result -----------------------
     TestUtil.AssertIsInstanceOf<IResolvableToValue<DateTime>>(dateTimeToday);
 }
Exemplo n.º 2
0
        public void Test_IResolvableToValueDateTime()
        {
            //---------------Set up test pack-------------------
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            DateTimeToday dateTimeToday = new DateTimeToday();

            //---------------Test Result -----------------------
            TestUtil.AssertIsInstanceOf <IResolvableToValue <DateTime> >(dateTimeToday);
        }
Exemplo n.º 3
0
 public void Test_ResolveToValue_WhenHasOffset1_ShouldResolveToTomorrow()
 {
     //---------------Set up test pack-------------------
     DateTimeToday dateTimeToday = new DateTimeToday {OffSet = 1};
     //---------------Assert Precondition----------------
     Assert.AreEqual(1, dateTimeToday.OffSet);
     //---------------Execute Test ----------------------
     DateTime resolveToValue = dateTimeToday.ResolveToValue();
     //---------------Test Result -----------------------
     Assert.AreEqual(DateTime.Today.AddDays(dateTimeToday.OffSet), resolveToValue);
 }
Exemplo n.º 4
0
        public void Test_Comparable_Equals_WithDateTimeTodayType()
        {
            //-------------Setup Test Pack ------------------
            DateTimeToday dateTimeToday = new DateTimeToday();
            IComparable   comparable    = dateTimeToday;
            //-------------Execute test ---------------------
            int i = comparable.CompareTo(new DateTimeToday());

            //-------------Test Result ----------------------
            Assert.AreEqual(0, i);
        }
Exemplo n.º 5
0
        public void Test_Equals_WithNull_ShouldReturnFalse()
        {
            //-------------Setup Test Pack ------------------
            DateTimeToday       dateTimeToday  = new DateTimeToday();
            const DateTimeToday dateTimeToday2 = null;
            //-------------Execute test ---------------------
            bool result = dateTimeToday.Equals(dateTimeToday2);

            //-------------Test Result ----------------------
            Assert.IsFalse(result);
        }
Exemplo n.º 6
0
        public void Test_Equals_WithDateTimeValue_ShouldReturnFalse()
        {
            //-------------Setup Test Pack ------------------
            DateTimeToday dateTimeToday = new DateTimeToday();
            DateTime      dateTime2     = DateTime.Now;
            //-------------Execute test ---------------------
            bool result = dateTimeToday.Equals(dateTime2);

            //-------------Test Result ----------------------
            Assert.IsFalse(result);
        }
Exemplo n.º 7
0
        public void Test_Equals_WithDateTimeTodayType_ShouldReturnTrue()
        {
            //-------------Setup Test Pack ------------------
            DateTimeToday dateTimeToday  = new DateTimeToday();
            DateTimeToday dateTimeToday2 = new DateTimeToday();
            //-------------Execute test ---------------------
            bool result = dateTimeToday.Equals(dateTimeToday2);

            //-------------Test Result ----------------------
            Assert.IsTrue(result);
        }
Exemplo n.º 8
0
        public void Test_SetOffSet_ShouldSetOffSet()
        {
            //---------------Set up test pack-------------------
            DateTimeToday dateTimeToday = new DateTimeToday();
            //---------------Assert Precondition----------------
            Assert.AreEqual(0, dateTimeToday.OffSet);
            //---------------Execute Test ----------------------
            dateTimeToday.OffSet = 1;

            //---------------Test Result -----------------------
            Assert.AreEqual(1, dateTimeToday.OffSet);
        }
 public void Test_ConvertTo_WithDateTime_ShouldReturnTodayValue()
 {
     //---------------Set up test pack-------------------
     DateTimeTodayConverter dateTimeTodayConverter = new DateTimeTodayConverter();
     DateTimeToday dateTimeToday = new DateTimeToday();
     DateTime snapshot = DateTime.Today;
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     object result = dateTimeTodayConverter.ConvertTo(dateTimeToday, typeof(DateTime));
     //---------------Test Result -----------------------
     DateTime dateTime = TestUtil.AssertIsInstanceOf<DateTime>(result);
     Assert.AreEqual(snapshot, dateTime);
 }
Exemplo n.º 10
0
 public void Test_IResolvableToValue_ResolveToValue()
 {
     //---------------Set up test pack-------------------
     DateTimeToday dateTimeToday = new DateTimeToday();
     IResolvableToValue<DateTime> resolvableToValue = dateTimeToday;
     DateTime today = DateTime.Today;
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     object resolvedValue = resolvableToValue.ResolveToValue();
     //---------------Test Result -----------------------
     DateTime dateTime = TestUtil.AssertIsInstanceOf<DateTime>(resolvedValue);
     Assert.AreEqual(today, dateTime);
 }
        public void Test_ConvertTo_WhenDateTimeTodayWithOfSet_ShouldRetOffSetValue()
        {
            //---------------Set up test pack-------------------
            DateTimeTodayConverter dateTimeTodayConverter = new DateTimeTodayConverter();
            DateTimeToday dateTimeToday = new DateTimeToday{OffSet = -5};
            DateTime expectedResult = DateTime.Today.AddDays(dateTimeToday.OffSet);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            object result = dateTimeTodayConverter.ConvertTo(dateTimeToday, typeof(DateTime));
            //---------------Test Result -----------------------
            Assert.AreEqual(expectedResult, result);
        }
Exemplo n.º 12
0
        public void Test_Comparable_OfDateTime_LessThan()
        {
            //-------------Setup Test Pack ------------------
            DateTimeToday          dateTimeToday = new DateTimeToday();
            IComparable <DateTime> comparable    = dateTimeToday;
            //-------------Test Pre-conditions --------------

            //-------------Execute test ---------------------
            int i = comparable.CompareTo(DateTimeToday.Value.AddDays(1));

            //-------------Test Result ----------------------
            Assert.AreEqual(-1, i);
        }
Exemplo n.º 13
0
        public void Test_DataMapper_ParsePropValue_FromDateTimeTodayObject()
        {
            //---------------Set up test pack-------------------
            DateTimeToday dateTimeToday = new DateTimeToday();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            object parsedValue;
            bool   parseSucceed = _dataMapper.TryParsePropValue(dateTimeToday, out parsedValue);

            //---------------Test Result -----------------------
            Assert.IsTrue(parseSucceed);
            Assert.AreEqual(dateTimeToday, parsedValue);
        }
Exemplo n.º 14
0
        public void Test_SetOffSet_ShouldSetOffSet()
        {
            //---------------Set up test pack-------------------
            DateTimeToday dateTimeToday = new DateTimeToday();

            //---------------Assert Precondition----------------
            Assert.AreEqual(0, dateTimeToday.OffSet);
            //---------------Execute Test ----------------------
            dateTimeToday.OffSet = 1;

            //---------------Test Result -----------------------
            Assert.AreEqual(1, dateTimeToday.OffSet);
        }
Exemplo n.º 15
0
        public void Test_DefaultTypeConverter_WithDateTime_ShouldReturnTodayValue()
        {
            //---------------Set up test pack-------------------
            TypeConverter typeConverter = TypeDescriptor.GetConverter(typeof(DateTimeToday));
            DateTimeToday dateTimeToday = new DateTimeToday();
            DateTime      snapshot      = DateTime.Today;
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            object result = typeConverter.ConvertTo(dateTimeToday, typeof(DateTime));
            //---------------Test Result -----------------------
            DateTime dateTime = TestUtil.AssertIsInstanceOf <DateTime>(result);

            Assert.AreEqual(snapshot, dateTime);
        }
Exemplo n.º 16
0
        public void Test_IResolvableToValue_ResolveToValue()
        {
            //---------------Set up test pack-------------------
            DateTimeToday dateTimeToday = new DateTimeToday();
            IResolvableToValue <DateTime> resolvableToValue = dateTimeToday;
            DateTime today = DateTime.Today;
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            object resolvedValue = resolvableToValue.ResolveToValue();
            //---------------Test Result -----------------------
            DateTime dateTime = TestUtil.AssertIsInstanceOf <DateTime>(resolvedValue);

            Assert.AreEqual(today, dateTime);
        }
Exemplo n.º 17
0
        public void Test_Comparable_GreaterThan()
        {
            //-------------Setup Test Pack ------------------
            DateTimeToday dateTimeToday = new DateTimeToday();
            IComparable   comparable    = dateTimeToday;
            DateTime      dateTime      = DateTimeToday.Value.AddDays(-1);
            //-------------Test Pre-conditions --------------

            //-------------Execute test ---------------------
            int i = comparable.CompareTo(dateTime);

            //-------------Test Result ----------------------
            Assert.AreEqual(1, i);
        }
Exemplo n.º 18
0
        public void Test_ToString()
        {
            //---------------Set up test pack-------------------
            DateTimeToday dteNow = new DateTimeToday();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            string toString = dteNow.ToString();
            //---------------Test Result -----------------------
            DateTime dteParsedDateTime;

            Assert.IsTrue(DateTime.TryParse(toString, out dteParsedDateTime));
            //            Assert.IsTrue(dteNow == dteParsedDateTime);
            Assert.AreEqual(toString, dteParsedDateTime.ToString());
        }
Exemplo n.º 19
0
        public void TestPrepareCriteria_ConvertsValue_StringTodayToDateTimeToday()
        {
            //---------------Set up test pack-------------------
            IClassDef     myBoClassDef   = MyBO.LoadClassDefWithDateTime();
            const string  dateTimeString = "Today";
            DateTimeToday dateTimeToday  = new DateTimeToday();
            Criteria      criteria       = new Criteria("TestDateTime", Criteria.ComparisonOp.Equals, dateTimeString);

            //---------------Execute Test ----------------------
            QueryBuilder.PrepareCriteria(myBoClassDef, criteria);

            //---------------Test Result -----------------------
            Assert.IsInstanceOf(typeof(DateTimeToday), criteria.FieldValue);
            Assert.AreEqual(dateTimeToday, criteria.FieldValue);
        }
Exemplo n.º 20
0
        public void Test_ResolveToValue_WhenHasOffset1_ShouldResolveToTomorrow()
        {
            //---------------Set up test pack-------------------
            DateTimeToday dateTimeToday = new DateTimeToday {
                OffSet = 1
            };

            //---------------Assert Precondition----------------
            Assert.AreEqual(1, dateTimeToday.OffSet);
            //---------------Execute Test ----------------------
            DateTime resolveToValue = dateTimeToday.ResolveToValue();

            //---------------Test Result -----------------------
            Assert.AreEqual(DateTime.Today.AddDays(dateTimeToday.OffSet), resolveToValue);
        }
Exemplo n.º 21
0
        public void Test_ConvertTo_WhenDateTimeTodayWithOfSet_ShouldRetOffSetValue()
        {
            //---------------Set up test pack-------------------
            DateTimeTodayConverter dateTimeTodayConverter = new DateTimeTodayConverter();
            DateTimeToday          dateTimeToday          = new DateTimeToday {
                OffSet = -5
            };
            DateTime expectedResult = DateTime.Today.AddDays(dateTimeToday.OffSet);
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            object result = dateTimeTodayConverter.ConvertTo(dateTimeToday, typeof(DateTime));

            //---------------Test Result -----------------------
            Assert.AreEqual(expectedResult, result);
        }
Exemplo n.º 22
0
    public static int Main(string[] args)
    {
        DateTimeToday today = new DateTimeToday();
        TestLibrary.TestFramework.BeginTestCase("Testing System.DateTime.Today property...");

        if (today.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return 100;
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return 0;
        }
    }
Exemplo n.º 23
0
    public static int Main(string[] args)
    {
        DateTimeToday today = new DateTimeToday();

        TestLibrary.TestFramework.BeginTestCase("Testing System.DateTime.Today property...");

        if (today.RunTests())
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("PASS");
            return(100);
        }
        else
        {
            TestLibrary.TestFramework.EndTestCase();
            TestLibrary.TestFramework.LogInformation("FAIL");
            return(0);
        }
    }
Exemplo n.º 24
0
        public void TestConvertValueToPropertyType_TodayStringToDateTimeToday_VariedCase()
        {
            //---------------Set up test pack-------------------
            PropDef propDef = new PropDef("a", typeof (DateTime), PropReadWriteRule.ReadWrite, null);
            const string dateTimeString = "ToDaY";
            DateTimeToday dateTimeToday = new DateTimeToday();

            //---------------Execute Test ----------------------
            object convertedDateTimeValue;
            bool parsed = propDef.TryParsePropValue(dateTimeString, out convertedDateTimeValue);

            //---------------Test Result -----------------------
            Assert.IsTrue(parsed);
            Assert.IsInstanceOf(typeof(DateTimeToday), convertedDateTimeValue);
            Assert.AreEqual(dateTimeToday, convertedDateTimeValue);
        }
Exemplo n.º 25
0
 public void Test_Comparable_Equals_WithDateTimeTodayType()
 {
     //-------------Setup Test Pack ------------------
     DateTimeToday dateTimeToday = new DateTimeToday();
     IComparable comparable = dateTimeToday;
     //-------------Execute test ---------------------
     int i = comparable.CompareTo(new DateTimeToday());
     //-------------Test Result ----------------------
     Assert.AreEqual(0, i);
 }
Exemplo n.º 26
0
 public void TestIsMatch_DateTimeToday_GreaterThan_NoMatch()
 {
     //---------------Set up test pack-------------------
     ClassDef.ClassDefs.Clear();
     ContactPersonTestBO.LoadDefaultClassDef();
     ContactPersonTestBO cp = new ContactPersonTestBO();
     cp.Surname = Guid.NewGuid().ToString("N");
     DateTimeToday dateTimeToday = new DateTimeToday();
     cp.DateOfBirth = DateTime.Today.AddDays(-1);
     //---------------Assert PreConditions---------------            
     //---------------Execute Test ----------------------
     Criteria criteria = new Criteria("DateOfBirth", Criteria.ComparisonOp.GreaterThan, dateTimeToday);
     bool isMatch = criteria.IsMatch(cp);
     //---------------Test Result -----------------------
     Assert.IsFalse(isMatch, "The object should not be a match since it does not match the criteria given.");
     //---------------Tear Down -------------------------          
 }
Exemplo n.º 27
0
        public void Test_Comparable_GreaterThan()
        {
            //-------------Setup Test Pack ------------------
            DateTimeToday dateTimeToday = new DateTimeToday();
            IComparable comparable = dateTimeToday;
            DateTime dateTime = DateTimeToday.Value.AddDays(-1);
            //-------------Test Pre-conditions --------------

            //-------------Execute test ---------------------
            int i = comparable.CompareTo(dateTime);
            //-------------Test Result ----------------------
            Assert.AreEqual(1, i);
        }
Exemplo n.º 28
0
        public void Test_Comparable_OfDateTime_LessThan()
        {
            //-------------Setup Test Pack ------------------
            DateTimeToday dateTimeToday = new DateTimeToday();
            IComparable<DateTime> comparable = dateTimeToday;
            //-------------Test Pre-conditions --------------

            //-------------Execute test ---------------------
            int i = comparable.CompareTo(DateTimeToday.Value.AddDays(1));
            //-------------Test Result ----------------------
            Assert.AreEqual(-1, i);
        }
Exemplo n.º 29
0
 public void Test_Equals_WithNull_ShouldReturnFalse()
 {
     //-------------Setup Test Pack ------------------
     DateTimeToday dateTimeToday = new DateTimeToday();
     const DateTimeToday dateTimeToday2 = null;
     //-------------Execute test ---------------------
     bool result = dateTimeToday.Equals(dateTimeToday2);
     //-------------Test Result ----------------------
     Assert.IsFalse(result);
 }
Exemplo n.º 30
0
 public void Test_Equals_WithDateTimeValue_ShouldReturnFalse()
 {
     //-------------Setup Test Pack ------------------
     DateTimeToday dateTimeToday = new DateTimeToday();
     DateTime dateTime2 = DateTime.Now;
     //-------------Execute test ---------------------
     bool result = dateTimeToday.Equals(dateTime2);
     //-------------Test Result ----------------------
     Assert.IsFalse(result);
 }
Exemplo n.º 31
0
 public void Test_Equals_WithDateTimeTodayType_ShouldReturnTrue()
 {
     //-------------Setup Test Pack ------------------
     DateTimeToday dateTimeToday = new DateTimeToday();
     DateTimeToday dateTimeToday2 = new DateTimeToday();
     //-------------Execute test ---------------------
     bool result = dateTimeToday.Equals(dateTimeToday2);
     //-------------Test Result ----------------------
     Assert.IsTrue(result);
 }
Exemplo n.º 32
0
        public void Test_ToString()
        {
            //---------------Set up test pack-------------------
            DateTimeToday dteNow = new DateTimeToday();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            string toString = dteNow.ToString();
            //---------------Test Result -----------------------
            DateTime dteParsedDateTime;
            Assert.IsTrue(DateTime.TryParse(toString, out dteParsedDateTime));
            //            Assert.IsTrue(dteNow == dteParsedDateTime);
            Assert.AreEqual(toString, dteParsedDateTime.ToString());
        }
Exemplo n.º 33
0
 public void Test_DataMapper_ParsePropValue_FromDateTimeTodayObject()
 {
     //---------------Set up test pack-------------------
     DateTimeToday dateTimeToday = new DateTimeToday();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     object parsedValue;
     bool parseSucceed = _dataMapper.TryParsePropValue(dateTimeToday, out parsedValue);
     //---------------Test Result -----------------------
     Assert.IsTrue(parseSucceed);
     Assert.AreEqual(dateTimeToday, parsedValue);
 }
Exemplo n.º 34
0
        public void TestConvertValueToPropertyType_DateTimeAcceptsDateTimeToday()
        {
            //---------------Set up test pack-------------------
            PropDef propDef = new PropDef("a", typeof (DateTime), PropReadWriteRule.ReadWrite, null);
            DateTimeToday dateTimeToday = new DateTimeToday();

            //---------------Execute Test ----------------------
            object convertedDateTimeValue;
            bool parsed = propDef.TryParsePropValue(dateTimeToday, out convertedDateTimeValue);

            //---------------Test Result -----------------------
            Assert.IsTrue(parsed);
            Assert.IsInstanceOf(typeof (DateTimeToday), convertedDateTimeValue);
            Assert.AreSame(dateTimeToday, convertedDateTimeValue);
        }
Exemplo n.º 35
0
        ///<summary>
        /// Tries to parse a value as an object to a valid DateTimeValue or a resolvable DateTimeValue.
        /// The valid value may not be a date but could instead return a <see cref="DateTimeToday"/> or <see cref="DateTimeNow"/> etc
        /// These objects are convertable to DateTime via the <see cref="DateTimeToday.ResolveToValue"/>
        ///</summary>
        ///<param name="valueToParse"></param>
        ///<param name="returnValue"></param>
        ///<returns>If the value cannot be parsed to a valid date time then returns false else true</returns>
        public static bool TryParseValue(object valueToParse, out object returnValue)
        {
            returnValue = null;
            if (valueToParse != null && valueToParse is string && ((string)valueToParse).Length == 0) return true;
            if(valueToParse == null || valueToParse == DBNull.Value) return true;

            if (!(valueToParse is DateTime))
            {
                if (valueToParse is DateTimeToday || valueToParse is DateTimeNow)
                {
                    returnValue = valueToParse;
                    return true;
                }
                if (valueToParse is String)
                {
                    string stringValueToConvert = (string)valueToParse;
                    var stringValueToConvertUpperCase = stringValueToConvert.ToUpper();
                    if (stringValueToConvertUpperCase == "TODAY")
                    {
                        returnValue = new DateTimeToday();
                        return true;
                    }
                    if (stringValueToConvertUpperCase == "YESTERDAY")
                    {
                        returnValue = new DateTimeToday();
                        ((DateTimeToday) returnValue).OffSet = -1;
                        return true;
                    }
                    if (stringValueToConvertUpperCase == "TOMORROW")
                    {
                        returnValue = new DateTimeToday();
                        ((DateTimeToday) returnValue).OffSet = 1;
                        return true;
                    }
                    if (stringValueToConvertUpperCase == "NOW")
                    {
                        returnValue = new DateTimeNow();
                        return true;
                    }
                  
                    DateTime dtOut;
                    if (DateTime.TryParseExact(stringValueToConvert, StandardDateTimeFormat, _dateTimeFormatProvider, DateTimeStyles.AllowWhiteSpaces, out dtOut))
                    {
                        returnValue = dtOut;
                        return true;
                    }
                }
                DateTime dateTimeOut;
                string valueToParseAsString = valueToParse.ToString();
                if (DateTime.TryParse(valueToParseAsString, out dateTimeOut))
                {
                    returnValue = dateTimeOut;
                    return true;
                }
                if (DateTime.TryParse(valueToParseAsString, new DateTimeFormatInfo { FullDateTimePattern = "dd/MM/yyyy HH:mm:ss:fff" }, DateTimeStyles.AllowWhiteSpaces, out dateTimeOut))
                {
                     returnValue = dateTimeOut;
                     return true;
                }
                if (DateTime.TryParse(valueToParseAsString, new DateTimeFormatInfo { FullDateTimePattern = "MM/dd/yyyy HH:mm:ss:fff" }, DateTimeStyles.AllowWhiteSpaces, out dateTimeOut))
                {
                    returnValue = dateTimeOut;
                    return true;
                }
                return false;
            }
            returnValue = valueToParse;
            return true;
        }
Exemplo n.º 36
0
 public void Test_Value_WhenDateTimeToday_ShouldReturnResolvedValue()
 {
     //---------------Set up test pack-------------------
     PropDef propDef = CreateTestPropDateTimePropDef();
     IBOProp boProp = propDef.CreateBOProp(true);
     DateTimeToday dateTimeToday = new DateTimeToday();
     boProp.Value = dateTimeToday;
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     object value = boProp.Value;
     //---------------Test Result -----------------------
     Assert.IsNotNull(value);
     Assert.AreNotSame(dateTimeToday, value);
 }
Exemplo n.º 37
0
        ///<summary>
        /// Tries to parse a value as an object to a valid DateTimeValue or a resolvable DateTimeValue.
        /// The valid value may not be a date but could instead return a <see cref="DateTimeToday"/> or <see cref="DateTimeNow"/> etc
        /// These objects are convertable to DateTime via the <see cref="DateTimeToday.ResolveToValue"/>
        ///</summary>
        ///<param name="valueToParse"></param>
        ///<param name="returnValue"></param>
        ///<returns>If the value cannot be parsed to a valid date time then returns false else true</returns>
        public static bool TryParseValue(object valueToParse, out object returnValue)
        {
            returnValue = null;
            if (valueToParse != null && valueToParse is string && ((string)valueToParse).Length == 0)
            {
                return(true);
            }
            if (valueToParse == null || valueToParse == DBNull.Value)
            {
                return(true);
            }

            if (!(valueToParse is DateTime))
            {
                if (valueToParse is DateTimeToday || valueToParse is DateTimeNow || valueToParse is DateTimeUtcNow)
                {
                    returnValue = valueToParse;
                    return(true);
                }
                if (valueToParse is String)
                {
                    string stringValueToConvert          = (string)valueToParse;
                    var    stringValueToConvertUpperCase = stringValueToConvert.ToUpper();
                    if (stringValueToConvertUpperCase == "TODAY")
                    {
                        returnValue = new DateTimeToday();
                        return(true);
                    }
                    if (stringValueToConvertUpperCase == "YESTERDAY")
                    {
                        returnValue = new DateTimeToday();
                        ((DateTimeToday)returnValue).OffSet = -1;
                        return(true);
                    }
                    if (stringValueToConvertUpperCase == "TOMORROW")
                    {
                        returnValue = new DateTimeToday();
                        ((DateTimeToday)returnValue).OffSet = 1;
                        return(true);
                    }
                    if (stringValueToConvertUpperCase == "NOW")
                    {
                        returnValue = new DateTimeNow();
                        return(true);
                    }
                    if (stringValueToConvertUpperCase == "UTCNOW")
                    {
                        returnValue = new DateTimeUtcNow();
                        return(true);
                    }

                    DateTime dtOut;
                    if (DateTime.TryParseExact(stringValueToConvert, StandardDateTimeFormat, _dateTimeFormatProvider, DateTimeStyles.AllowWhiteSpaces, out dtOut))
                    {
                        returnValue = dtOut;
                        return(true);
                    }
                }
                DateTime dateTimeOut;
                string   valueToParseAsString = valueToParse.ToString();
                if (DateTime.TryParse(valueToParseAsString, out dateTimeOut))
                {
                    returnValue = dateTimeOut;
                    return(true);
                }
                if (DateTime.TryParse(valueToParseAsString, new DateTimeFormatInfo {
                    FullDateTimePattern = "dd/MM/yyyy HH:mm:ss:fff"
                }, DateTimeStyles.AllowWhiteSpaces, out dateTimeOut))
                {
                    returnValue = dateTimeOut;
                    return(true);
                }
                if (DateTime.TryParse(valueToParseAsString, new DateTimeFormatInfo {
                    FullDateTimePattern = "MM/dd/yyyy HH:mm:ss:fff"
                }, DateTimeStyles.AllowWhiteSpaces, out dateTimeOut))
                {
                    returnValue = dateTimeOut;
                    return(true);
                }
                return(false);
            }
            returnValue = valueToParse;
            return(true);
        }