Ejemplo n.º 1
0
        public void ComponentModelCompatibilityTest()
        {
            var converter   = new DateTimeConverter();
            var cmConverter = new System.ComponentModel.DateTimeConverter();

            var typeConverterOptions = new TypeConverterOptions {
                CultureInfo = CultureInfo.CurrentCulture
            };

            var val = (DateTime)cmConverter.ConvertFromString("");

            Assert.AreEqual(DateTime.MinValue, val);

            val = (DateTime)converter.ConvertFromExcel(typeConverterOptions, "");
            Assert.AreEqual(DateTime.MinValue, val);

            val = (DateTime)converter.ConvertFromExcel(typeConverterOptions, null);
            Assert.AreEqual(DateTime.MinValue, val);

            try {
                cmConverter.ConvertFromString("blah");
                Assert.Fail();
            } catch (FormatException) {
            }

            try {
                converter.ConvertFromExcel(typeConverterOptions, "blah");
            } catch (FormatException) {
            }
        }
Ejemplo n.º 2
0
        public void ComponentModelCompatibilityTest()
        {
            var converter   = new DateTimeConverter();
            var cmConverter = new System.ComponentModel.DateTimeConverter();

            var propertyMapData = new MemberMapData(null);

            propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture;

            var row = new CsvReader(new ParserMock());

            Assert.ThrowsException <NotSupportedException>(() => cmConverter.ConvertFromString(null));
            Assert.ThrowsException <TypeConverterException>(() => converter.ConvertFromString(null, row, propertyMapData));
            Assert.ThrowsException <FormatException>(() => cmConverter.ConvertFromString("blah"));
            Assert.ThrowsException <FormatException>(() => converter.ConvertFromString("blah", row, propertyMapData));
        }
Ejemplo n.º 3
0
        public static bool _ConvertFrom_System_ComponentModel_DateTimeConverter_System_ComponentModel_ITypeDescriptorContext_System_Globalization_CultureInfo_System_Object( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

            //Parameters
            System.ComponentModel.ITypeDescriptorContext context = null;
            System.Globalization.CultureInfo             culture = null;
            System.Object _value = null;

            //ReturnType/Value
            System.Object returnVal_Real        = null;
            System.Object returnVal_Intercepted = null;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_DateTimeConverter.ConvertFrom(context, culture, _value);
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.ConvertFrom(context, culture, _value);
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _CreateInstance_System_ComponentModel_DateTimeConverter_System_ComponentModel_ITypeDescriptorContext_System_Collections_IDictionary( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

            //Parameters
            System.ComponentModel.ITypeDescriptorContext context = null;
            System.Collections.IDictionary propertyValues        = null;

            //ReturnType/Value
            System.Object returnVal_Real        = null;
            System.Object returnVal_Intercepted = null;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_DateTimeConverter.CreateInstance(context, propertyValues);
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.CreateInstance(context, propertyValues);
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _CanConvertTo_System_ComponentModel_DateTimeConverter_System_ComponentModel_ITypeDescriptorContext_System_Type( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

            //Parameters
            System.ComponentModel.ITypeDescriptorContext context = null;
            System.Type destinationType = null;

            //ReturnType/Value
            System.Boolean returnVal_Real        = false;
            System.Boolean returnVal_Intercepted = false;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_DateTimeConverter.CanConvertTo(context, destinationType);
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.CanConvertTo(context, destinationType);
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _GetProperties_System_ComponentModel_DateTimeConverter_System_ComponentModel_ITypeDescriptorContext_System_Object( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

            //Parameters
            System.ComponentModel.ITypeDescriptorContext context = null;
            System.Object _value = null;

            //ReturnType/Value
            System.ComponentModel.PropertyDescriptorCollection returnVal_Real        = null;
            System.ComponentModel.PropertyDescriptorCollection returnVal_Intercepted = null;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_DateTimeConverter.GetProperties(context, _value);
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.GetProperties(context, _value);
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _ConvertFromString_System_ComponentModel_DateTimeConverter_System_String( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

            //Parameters
            System.String text = null;

            //ReturnType/Value
            System.Object returnVal_Real        = null;
            System.Object returnVal_Intercepted = null;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_DateTimeConverter.ConvertFromString(text);
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.ConvertFromString(text);
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
Ejemplo n.º 8
0
        public static bool _IsValid_System_ComponentModel_DateTimeConverter_System_Object( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

            //Parameters
            System.Object _value = null;

            //ReturnType/Value
            System.Boolean returnVal_Real        = false;
            System.Boolean returnVal_Intercepted = false;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_DateTimeConverter.IsValid(_value);
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.IsValid(_value);
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _CanConvertTo_System_ComponentModel_DateTimeConverter_System_ComponentModel_ITypeDescriptorContext_System_Type( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

               //Parameters
               System.ComponentModel.ITypeDescriptorContext context = null;
               System.Type destinationType = null;

               //ReturnType/Value
               System.Boolean returnVal_Real = false;
               System.Boolean returnVal_Intercepted = false;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_DateTimeConverter.CanConvertTo(context,destinationType);
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.CanConvertTo(context,destinationType);
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
Ejemplo n.º 10
0
        public void ComponentModelCompatibilityTest()
        {
            var converter   = new DateTimeConverter();
            var cmConverter = new System.ComponentModel.DateTimeConverter();

            var propertyMapData = new CsvPropertyMapData(null);

            propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture;

            var val = (DateTime)cmConverter.ConvertFromString("");

            Assert.AreEqual(DateTime.MinValue, val);

            val = (DateTime)converter.ConvertFromString("", null, propertyMapData);
            Assert.AreEqual(DateTime.MinValue, val);

            try
            {
                cmConverter.ConvertFromString(null);
                Assert.Fail();
            }
            catch (NotSupportedException) {}

            try
            {
                converter.ConvertFromString(null, null, propertyMapData);
                Assert.Fail();
            }
            catch (CsvTypeConverterException) { }

            try
            {
                cmConverter.ConvertFromString("blah");
                Assert.Fail();
            }
            catch (FormatException) {}

            try
            {
                converter.ConvertFromString("blah", null, propertyMapData);
            }
            catch (FormatException) {}
        }
        public static bool _GetStandardValues_System_ComponentModel_DateTimeConverter( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

            //Parameters

            //ReturnType/Value
            System.Collections.ICollection returnVal_Real        = null;
            System.Collections.ICollection returnVal_Intercepted = null;

            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                returnVal_Real = _System_ComponentModel_DateTimeConverter.GetStandardValues();
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.GetStandardValues();
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Messsage == exception_Intercepted.Message) && (returnValue_Real == returnValue_Intercepted));
        }
        public static bool _ConvertFromString_System_ComponentModel_DateTimeConverter_System_ComponentModel_ITypeDescriptorContext_System_String( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

               //Parameters
               System.ComponentModel.ITypeDescriptorContext context = null;
               System.String text = null;

               //ReturnType/Value
               System.Object returnVal_Real = null;
               System.Object returnVal_Intercepted = null;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_DateTimeConverter.ConvertFromString(context,text);
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.ConvertFromString(context,text);
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
        public static bool _GetProperties_System_ComponentModel_DateTimeConverter_System_ComponentModel_ITypeDescriptorContext_System_Object( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

               //Parameters
               System.ComponentModel.ITypeDescriptorContext context = null;
               System.Object _value = null;

               //ReturnType/Value
               System.ComponentModel.PropertyDescriptorCollection returnVal_Real = null;
               System.ComponentModel.PropertyDescriptorCollection returnVal_Intercepted = null;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_DateTimeConverter.GetProperties(context,_value);
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.GetProperties(context,_value);
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
        public static bool _CreateInstance_System_ComponentModel_DateTimeConverter_System_ComponentModel_ITypeDescriptorContext_System_Collections_IDictionary( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

               //Parameters
               System.ComponentModel.ITypeDescriptorContext context = null;
               System.Collections.IDictionary propertyValues = null;

               //ReturnType/Value
               System.Object returnVal_Real = null;
               System.Object returnVal_Intercepted = null;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_DateTimeConverter.CreateInstance(context,propertyValues);
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.CreateInstance(context,propertyValues);
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
Ejemplo n.º 15
0
		public void ComponentModelCompatibilityTest()
		{
			var converter = new DateTimeConverter();
			var cmConverter = new System.ComponentModel.DateTimeConverter();

			var typeConverterOptions = new TypeConverterOptions
			{
				CultureInfo = CultureInfo.CurrentCulture
			};

			var val = (DateTime)cmConverter.ConvertFromString( "" );
			Assert.AreEqual( DateTime.MinValue, val );

			val = (DateTime)converter.ConvertFromString( typeConverterOptions, "" );
			Assert.AreEqual( DateTime.MinValue, val );

			try
			{
				cmConverter.ConvertFromString( null );
				Assert.Fail();
			}
			catch( NotSupportedException ){}

			try
			{
				converter.ConvertFromString( typeConverterOptions, null );
				Assert.Fail();
			}
			catch( CsvTypeConverterException ) { }

			try
			{
				cmConverter.ConvertFromString( "blah" );
				Assert.Fail();
			}
			catch( FormatException ){}

			try
			{
				converter.ConvertFromString( typeConverterOptions, "blah" );
			}
			catch( FormatException ){}
		}
        public static bool _ConvertToInvariantString_System_ComponentModel_DateTimeConverter_System_Object( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

               //Parameters
               System.Object _value = null;

               //ReturnType/Value
               System.String returnVal_Real = null;
               System.String returnVal_Intercepted = null;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_DateTimeConverter.ConvertToInvariantString(_value);
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.ConvertToInvariantString(_value);
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
        public static bool _GetStandardValuesExclusive_System_ComponentModel_DateTimeConverter( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

               //Parameters

               //ReturnType/Value
               System.Boolean returnVal_Real = false;
               System.Boolean returnVal_Intercepted = false;

               //Exception
               System.Exception exception_Real = null;
               System.Exception exception_Intercepted = null;

               InterceptionMaintenance.disableInterception( );

               try
               {
              returnVal_Real = _System_ComponentModel_DateTimeConverter.GetStandardValuesExclusive();
               }

               catch( System.Exception e )
               {
              exception_Real = e;
               }

               InterceptionMaintenance.enableInterception( );

               try
               {
              returnVal_Intercepted = _System_ComponentModel_DateTimeConverter.GetStandardValuesExclusive();
               }

               catch( System.Exception e )
               {
              exception_Intercepted = e;
               }

               return( ( exception_Real.Messsage == exception_Intercepted.Message ) && ( returnValue_Real == returnValue_Intercepted ) );
        }
        public static bool _ctor_System_ComponentModel_DateTimeConverter( )
        {
            //class object
            System.ComponentModel.DateTimeConverter _System_ComponentModel_DateTimeConverter = new System.ComponentModel.DateTimeConverter();

            //Parameters


            //Exception
            System.Exception exception_Real        = null;
            System.Exception exception_Intercepted = null;

            InterceptionMaintenance.disableInterception( );

            try
            {
                _System_ComponentModel_DateTimeConverter.ctor();
            }

            catch (System.Exception e)
            {
                exception_Real = e;
            }


            InterceptionMaintenance.enableInterception( );

            try
            {
                _System_ComponentModel_DateTimeConverter.ctor();
            }

            catch (System.Exception e)
            {
                exception_Intercepted = e;
            }


            return((exception_Real.Message == exception_Intercepted.Message));
        }
        public void ComponentModelCompatibilityTest()
        {
            var converter   = new DateTimeConverter();
            var cmConverter = new System.ComponentModel.DateTimeConverter();

            var propertyMapData = new MemberMapData(null);

            propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture;

            var mockRow = new Mock <IReaderRow>();

            try
            {
                cmConverter.ConvertFromString(null);
                Assert.Fail();
            }
            catch (NotSupportedException) {}

            try
            {
                converter.ConvertFromString(null, mockRow.Object, propertyMapData);
                Assert.Fail();
            }
            catch (TypeConverterException) { }

            try
            {
                cmConverter.ConvertFromString("blah");
                Assert.Fail();
            }
            catch (FormatException) {}

            try
            {
                converter.ConvertFromString("blah", mockRow.Object, propertyMapData);
            }
            catch (FormatException) {}
        }
Ejemplo n.º 20
0
        public void ComponentModelCompatibilityTest()
        {
            var converter = new DateTimeConverter();
            var cmConverter = new System.ComponentModel.DateTimeConverter();

            var propertyMapData = new CsvPropertyMapData( null );
            propertyMapData.TypeConverterOptions.CultureInfo = CultureInfo.CurrentCulture;

            try
            {
                cmConverter.ConvertFromString( null );
                Assert.Fail();
            }
            catch( NotSupportedException ){}

            try
            {
                converter.ConvertFromString( null, null, propertyMapData );
                Assert.Fail();
            }
            catch( CsvTypeConverterException ) { }

            try
            {
                cmConverter.ConvertFromString( "blah" );
                Assert.Fail();
            }
            catch( FormatException ){}

            try
            {
                converter.ConvertFromString( "blah", null, propertyMapData );
            }
            catch( FormatException ){}
        }