当前位置: 首页>>代码示例>>C#>>正文


C# MockFactory.CreateInstance方法代码示例

本文整理汇总了C#中MockFactory.CreateInstance方法的典型用法代码示例。如果您正苦于以下问题:C# MockFactory.CreateInstance方法的具体用法?C# MockFactory.CreateInstance怎么用?C# MockFactory.CreateInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MockFactory的用法示例。


在下文中一共展示了MockFactory.CreateInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShouldCreateAndEvaluateTest

		public void ShouldCreateAndEvaluateTest()
		{
			TransientFactoryMethodDependencyResolution transientFactoryMethodDependencyResolution;
			IDependencyManager mockDependencyManager;
			Func<object> value;
			object result;
			MockFactory mockFactory;

			mockFactory = new MockFactory();
			mockDependencyManager = mockFactory.CreateInstance<IDependencyManager>();

			value = () => 11;

			transientFactoryMethodDependencyResolution = new TransientFactoryMethodDependencyResolution(value);

			Assert.AreEqual(DependencyLifetime.Transient, transientFactoryMethodDependencyResolution.DependencyLifetime);

			result = transientFactoryMethodDependencyResolution.Resolve(mockDependencyManager, typeof(object), string.Empty);

			Assert.IsNotNull(result);
			Assert.AreEqual(11, result);

			transientFactoryMethodDependencyResolution.Dispose();

			mockFactory.VerifyAllExpectationsHaveBeenMet();
		}
开发者ID:textmetal,项目名称:main,代码行数:26,代码来源:TransientFactoryMethodDependencyResolutionTests.cs

示例2: ShouldCreateAndEvaluateTest

		public void ShouldCreateAndEvaluateTest()
		{
			InstanceDependencyResolution instanceDependencyResolution;
			IDependencyManager mockDependencyManager;
			int value;
			object result;
			MockFactory mockFactory;

			mockFactory = new MockFactory();
			mockDependencyManager = mockFactory.CreateInstance<IDependencyManager>();

			value = 11;

			instanceDependencyResolution = new InstanceDependencyResolution(value);

			Assert.AreEqual(DependencyLifetime.Instance, instanceDependencyResolution.DependencyLifetime);

			result = instanceDependencyResolution.Resolve(mockDependencyManager, typeof(object), string.Empty);

			Assert.IsNotNull(result);
			Assert.AreEqual(11, result);

			instanceDependencyResolution.Dispose();

			mockFactory.VerifyAllExpectationsHaveBeenMet();
		}
开发者ID:textmetal,项目名称:main,代码行数:26,代码来源:InstanceDependencyResolutionTests.cs

示例3: ShouldCreateAndEvaluateTest

		public void ShouldCreateAndEvaluateTest()
		{
			TransientActivatorAutoWiringDependencyResolution<MockDependantObject> transientActivatorAutoWiringDependencyResolution;
			IDependencyManager mockDependencyManager;
			MockDependantObject result;
			MockFactory mockFactory;
			string _unusedString = null;
			bool _unusedBoolean = false;
			Type _unusedType = null;

			mockFactory = new MockFactory();
			mockDependencyManager = mockFactory.CreateInstance<IDependencyManager>();

			Expect.On(mockDependencyManager).One.Method(m => m.ResolveDependency(_unusedType, _unusedString, _unusedBoolean)).With(typeof(MockDependantObject), "named_dep_obj", true).Will(Return.Value(new MockDependantObject("left")));
			Expect.On(mockDependencyManager).One.Method(m => m.ResolveDependency(_unusedType, _unusedString, _unusedBoolean)).With(typeof(MockDependantObject), string.Empty, true).Will(Return.Value(new MockDependantObject("right")));

			transientActivatorAutoWiringDependencyResolution = new TransientActivatorAutoWiringDependencyResolution<MockDependantObject>();

			Assert.AreEqual(DependencyLifetime.Transient, transientActivatorAutoWiringDependencyResolution.DependencyLifetime);

			result = transientActivatorAutoWiringDependencyResolution.Resolve(mockDependencyManager, string.Empty);

			Assert.IsNotNull(result);
			Assert.IsInstanceOf<MockDependantObject>(result);
			Assert.IsNotNull(result.Text);
			Assert.AreEqual(string.Empty, result.Text);
			Assert.IsNotNull(result.Left);
			Assert.IsNotNull(result.Right);
			Assert.AreEqual("left", result.Left.Text);
			Assert.AreEqual("right", result.Right.Text);

			transientActivatorAutoWiringDependencyResolution.Dispose();

			mockFactory.VerifyAllExpectationsHaveBeenMet();
		}
开发者ID:textmetal,项目名称:main,代码行数:35,代码来源:TransientActivatorAutoWiringDependencyResolutionArity1Tests.cs

示例4: ShouldFailOnDataTypeFascadeCreateTest

		public void ShouldFailOnDataTypeFascadeCreateTest()
		{
			AppConfigFascade appConfigFascade;
			IConfigurationRoot mockConfigurationRoot;
			IDataTypeFascade mockDataTypeFascade;
			MockFactory mockFactory;

			mockFactory = new MockFactory();
			mockConfigurationRoot = mockFactory.CreateInstance<IConfigurationRoot>();
			mockDataTypeFascade = null;

			appConfigFascade = new AppConfigFascade(mockConfigurationRoot, mockDataTypeFascade);
		}
开发者ID:textmetal,项目名称:main,代码行数:13,代码来源:AppConfigFascadeTests.cs

示例5: ShouldCreateAndEvaluateTest

		public void ShouldCreateAndEvaluateTest()
		{
			ContextWrapperDependencyResolution contextWrapperDependencyResolution;
			IDependencyManager mockDependencyManager;
			IDependencyResolution mockDependencyResolution;
			IDependencyManager _unusedDependencyManager = null;
			Type _unusedType = null;
			string _unusedString = null;
			object result;
			const int EXPECTED = 11;
			MockFactory mockFactory;

			mockFactory = new MockFactory();
			mockDependencyManager = mockFactory.CreateInstance<IDependencyManager>();
			mockDependencyResolution = mockFactory.CreateInstance<IDependencyResolution>();

			Expect.On(mockDependencyResolution).One.Method(m => m.Resolve(_unusedDependencyManager, _unusedType, _unusedString)).With(mockDependencyManager, typeof(object), string.Empty).WillReturn(EXPECTED);
			Expect.On(mockDependencyResolution).One.Method(m => m.Dispose());

			contextWrapperDependencyResolution = new ContextWrapperDependencyResolution(ContextScope.LocalThreadSafe, mockDependencyResolution);

			Assert.AreEqual(DependencyLifetime.Singleton, contextWrapperDependencyResolution.DependencyLifetime);

			// should be thawed at this point
			result = contextWrapperDependencyResolution.Resolve(mockDependencyManager, typeof(object), string.Empty);

			Assert.IsNotNull(result);
			Assert.AreEqual(EXPECTED, result);

			// should be frozen at this point
			result = contextWrapperDependencyResolution.Resolve(mockDependencyManager, typeof(object), string.Empty);

			Assert.IsNotNull(result);
			Assert.AreEqual(EXPECTED, result);

			contextWrapperDependencyResolution.Dispose();

			mockFactory.VerifyAllExpectationsHaveBeenMet();
		}
开发者ID:textmetal,项目名称:main,代码行数:39,代码来源:ContextWrapperDependencyResolutionTests.cs

示例6: ShouldCreateAndEvaluateUntypedTest

		public void ShouldCreateAndEvaluateUntypedTest()
		{
			SingletonWrapperDependencyResolution<int> singletonWrapperDependencyResolution;
			IDependencyManager mockDependencyManager;
			IDependencyResolution<int> mockDependencyResolution;
			IDependencyManager _unusedDependencyManager = null;
			string _unusedString = null;
			object result;
			MockFactory mockFactory;

			mockFactory = new MockFactory();
			mockDependencyManager = mockFactory.CreateInstance<IDependencyManager>();
			mockDependencyResolution = mockFactory.CreateInstance<IDependencyResolution<int>>();

			Expect.On(mockDependencyResolution).One.Method(m => m.Resolve(_unusedDependencyManager, _unusedString)).With(mockDependencyManager, string.Empty).WillReturn(11);
			Expect.On(mockDependencyResolution).One.Method(m => m.Dispose());

			singletonWrapperDependencyResolution = new SingletonWrapperDependencyResolution<int>(mockDependencyResolution);

			Assert.AreEqual(DependencyLifetime.Singleton, singletonWrapperDependencyResolution.DependencyLifetime);

			// should be thawed at this point
			result = singletonWrapperDependencyResolution.Resolve(mockDependencyManager, typeof(int), string.Empty);

			Assert.IsNotNull(result);
			Assert.AreEqual(11, result);

			// should be frozen at this point
			result = singletonWrapperDependencyResolution.Resolve(mockDependencyManager, typeof(int), string.Empty);

			Assert.IsNotNull(result);
			Assert.AreEqual(11, result);

			singletonWrapperDependencyResolution.Dispose();

			mockFactory.VerifyAllExpectationsHaveBeenMet();
		}
开发者ID:textmetal,项目名称:main,代码行数:37,代码来源:SingletonWrapperDependencyResolutionArity1Tests.cs

示例7: ShouldExecuteReaderCloseConnectionSprocWithParametersTest

		public void ShouldExecuteReaderCloseConnectionSprocWithParametersTest()
		{
			IAdoNetYieldingFascade adoNetYieldingFascade;
			MockFactory mockFactory;
			DbConnection mockDbConnection;
			DbCommand mockDbCommand;
			DbParameterCollection mockDbParameterCollection;
			DbParameter[] mockDbParameters;
			DbParameter mockDbParameter0;
			DbParameter mockDbParameter1;
			DbDataReader mockDbDataReader;
			IReflectionFascade mockReflectionFascade;

			DbDataReader dbDataReader;

			CommandBehavior _unusedCommandBehavior = CommandBehavior.Default;
			DbParameter _unusedDbParameter = null;

			mockFactory = new MockFactory();
			mockDbConnection = mockFactory.CreateInstance<DbConnection>();
			mockDbCommand = mockFactory.CreateInstance<DbCommand>();
			mockDbParameterCollection = mockFactory.CreateInstance<DbParameterCollection>();
			mockDbParameter0 = mockFactory.CreateInstance<DbParameter>();
			mockDbParameter1 = mockFactory.CreateInstance<DbParameter>();
			mockDbParameters = new DbParameter[] { mockDbParameter0, mockDbParameter1 };
			mockDbDataReader = mockFactory.CreateInstance<DbDataReader>();
			mockReflectionFascade = mockFactory.CreateInstance<IReflectionFascade>();

			Expect.On(mockDbConnection).One.Method(x => x.CreateCommand()).Will(Return.Value(mockDbCommand));
			Expect.On(mockDbCommand).Exactly(2).GetProperty(x => x.Parameters).Will(Return.Value(mockDbParameterCollection));
			Expect.On(mockDbCommand).One.Method(x => x.Dispose());
			Expect.On(mockDbCommand).One.SetProperty(x => x.CommandType).To(CommandType.StoredProcedure);
			Expect.On(mockDbCommand).One.SetProperty(x => x.CommandText).To("blah blah blah");
			Expect.On(mockDbCommand).One.SetProperty(x => x.Transaction).To(null);
			Expect.On(mockDbCommand).One.Method(x => x.ExecuteReader(_unusedCommandBehavior)).With(CommandBehavior.CloseConnection).Will(Return.Value(mockDbDataReader));
			Expect.On(mockDbParameter0).One.GetProperty(x => x.Value).Will(Return.Value(1));
			Expect.On(mockDbParameter1).One.GetProperty(x => x.Value).Will(Return.Value(null));
			Expect.On(mockDbParameter1).One.SetProperty(x => x.Value).To(DBNull.Value);
			Expect.On(mockDbParameterCollection).One.Method(x => x.Add(_unusedDbParameter)).With(mockDbParameter0).Will(Return.Value(0));
			Expect.On(mockDbParameterCollection).One.Method(x => x.Add(_unusedDbParameter)).With(mockDbParameter1).Will(Return.Value(0));
			Expect.On(mockDbDataReader).One.Method(x => x.Dispose());

			adoNetYieldingFascade = new AdoNetYieldingFascade(mockReflectionFascade);

			dbDataReader = adoNetYieldingFascade.ExecuteReader(mockDbConnection, null, CommandType.StoredProcedure, "blah blah blah", mockDbParameters, CommandBehavior.CloseConnection, null, false);

			Assert.IsNotNull(dbDataReader);

			dbDataReader.Dispose();

			mockFactory.VerifyAllExpectationsHaveBeenMet();
		}
开发者ID:textmetal,项目名称:main,代码行数:52,代码来源:AdoNetYieldingFascadeTests.cs

示例8: ShouldFailOnNullDependencyManagerResolveTest

		public void ShouldFailOnNullDependencyManagerResolveTest()
		{
			SingletonWrapperDependencyResolution singletonWrapperDependencyResolution;
			IDependencyManager mockDependencyManager;
			IDependencyResolution mockDependencyResolution;
			object result;
			MockFactory mockFactory;

			mockFactory = new MockFactory();
			mockDependencyManager = null;
			mockDependencyResolution = mockFactory.CreateInstance<IDependencyResolution>();

			singletonWrapperDependencyResolution = new SingletonWrapperDependencyResolution(mockDependencyResolution);

			result = singletonWrapperDependencyResolution.Resolve(mockDependencyManager, typeof(object), string.Empty);
		}
开发者ID:textmetal,项目名称:main,代码行数:16,代码来源:SingletonWrapperDependencyResolutionTests.cs

示例9: IsValidAssemblyLoaderEventSinkMethod

		public static void IsValidAssemblyLoaderEventSinkMethod(AssemblyLoaderEventType assemblyLoaderEventType, AssemblyLoaderContainerContext assemblyLoaderContainerContext)
		{
			if ((object)assemblyLoaderContainerContext == null)
				throw new ArgumentNullException(nameof(assemblyLoaderContainerContext));

			switch (assemblyLoaderEventType)
			{
				case AssemblyLoaderEventType.Startup:
					MockFactory mockFactory;
					IDependencyResolution mockDependencyResolution;

					IDependencyManager _unusedDependencyManager = null;
					Type _unusedType = null;
					string _unusedString = null;
					Type targetType;
					string selectorKey;
					bool includeAssignableTypes;

					mockFactory = new MockFactory();
					mockDependencyResolution = mockFactory.CreateInstance<IDependencyResolution>();

					targetType = typeof(IFormattable);
					selectorKey = UNCOMMON_SELECTOR_KEY;
					includeAssignableTypes = false;

					assemblyLoaderContainerContext.DependencyManager.AddResolution(targetType, selectorKey, includeAssignableTypes, mockDependencyResolution);

					Expect.On(mockDependencyResolution).Any.Method(m => m.Resolve(_unusedDependencyManager, _unusedType, _unusedString)).With(assemblyLoaderContainerContext.DependencyManager, targetType, selectorKey).WillReturn(1234.5678);

					Expect.On(mockDependencyResolution).One.Method(m => m.Dispose());

					break;
				case AssemblyLoaderEventType.Shutdown:
					break;
				default:
					throw new ArgumentOutOfRangeException(nameof(assemblyLoaderEventType), assemblyLoaderEventType, null);
			}
		}
开发者ID:textmetal,项目名称:main,代码行数:38,代码来源:DependencyManagerTests.cs

示例10: ShouldCreateAndEvaluateTest

		public void ShouldCreateAndEvaluateTest()
		{
			TransientDefaultConstructorDependencyResolution<MockDependantObject> transientDefaultConstructorDependencyResolution;
			IDependencyManager mockDependencyManager;
			MockDependantObject result;
			MockFactory mockFactory;

			mockFactory = new MockFactory();
			mockDependencyManager = mockFactory.CreateInstance<IDependencyManager>();

			transientDefaultConstructorDependencyResolution = new TransientDefaultConstructorDependencyResolution<MockDependantObject>();

			Assert.AreEqual(DependencyLifetime.Transient, transientDefaultConstructorDependencyResolution.DependencyLifetime);

			result = transientDefaultConstructorDependencyResolution.Resolve(mockDependencyManager, string.Empty);

			Assert.IsNotNull(result);
			Assert.IsNull(result.Text);

			transientDefaultConstructorDependencyResolution.Dispose();

			mockFactory.VerifyAllExpectationsHaveBeenMet();
		}
开发者ID:textmetal,项目名称:main,代码行数:23,代码来源:TransientDefaultConstructorDependencyResolutionArity1Tests.cs

示例11: ShouldCreateTest

		public void ShouldCreateTest()
		{
			Tokenizer tokenizer;
			MockFactory mockFactory;
			IDictionary<string, ITokenReplacementStrategy> mockTokenReplacementStrategies;

			mockFactory = new MockFactory();
			mockTokenReplacementStrategies = mockFactory.CreateInstance<IDictionary<string, ITokenReplacementStrategy>>();

			tokenizer = new Tokenizer(true);

			Assert.IsNotNull(tokenizer);
			Assert.IsNotNull(tokenizer.TokenReplacementStrategies);
			Assert.IsTrue(tokenizer.StrictMatching);

			tokenizer = new Tokenizer(mockTokenReplacementStrategies, true);

			Assert.IsNotNull(tokenizer);
			Assert.IsNotNull(tokenizer.TokenReplacementStrategies);
			Assert.IsTrue(tokenizer.StrictMatching);

			mockFactory.VerifyAllExpectationsHaveBeenMet();
		}
开发者ID:textmetal,项目名称:main,代码行数:23,代码来源:TokenizerTests.cs

示例12: ShouldFailOnNullKeyHasAppSettingTest

		public void ShouldFailOnNullKeyHasAppSettingTest()
		{
			AppConfigFascade appConfigFascade;
			IConfigurationRoot mockConfigurationRoot;
			IDataTypeFascade mockDataTypeFascade;
			MockFactory mockFactory;
			const string KEY = null;

			mockFactory = new MockFactory();
			mockConfigurationRoot = mockFactory.CreateInstance<IConfigurationRoot>();
			mockDataTypeFascade = mockFactory.CreateInstance<IDataTypeFascade>();

			appConfigFascade = new AppConfigFascade(mockConfigurationRoot, mockDataTypeFascade);

			appConfigFascade.HasAppSetting(KEY);
		}
开发者ID:textmetal,项目名称:main,代码行数:16,代码来源:AppConfigFascadeTests.cs

示例13: ShouldExecuteReaderCloseConnectionTextNoParametersTest

		public void ShouldExecuteReaderCloseConnectionTextNoParametersTest()
		{
			IAdoNetYieldingFascade adoNetYieldingFascade;
			MockFactory mockFactory;
			DbConnection mockDbConnection;
			DbCommand mockDbCommand;
			DbDataReader mockDbDataReader;
			IReflectionFascade mockReflectionFascade;

			DbDataReader dbDataReader;

			CommandBehavior _unusedCommandBehavior = CommandBehavior.Default;

			mockFactory = new MockFactory();
			mockDbConnection = mockFactory.CreateInstance<DbConnection>();
			mockDbCommand = mockFactory.CreateInstance<DbCommand>();
			mockDbDataReader = mockFactory.CreateInstance<DbDataReader>();
			mockReflectionFascade = mockFactory.CreateInstance<IReflectionFascade>();

			Expect.On(mockDbConnection).One.Method(x => x.CreateCommand()).Will(Return.Value(mockDbCommand));
			Expect.On(mockDbCommand).One.Method(x => x.Dispose());
			Expect.On(mockDbCommand).One.SetProperty(x => x.CommandType).To(CommandType.Text);
			Expect.On(mockDbCommand).One.SetProperty(x => x.CommandText).To("blah blah blah");
			Expect.On(mockDbCommand).One.SetProperty(x => x.Transaction).To(null);
			Expect.On(mockDbCommand).One.Method(x => x.ExecuteReader(_unusedCommandBehavior)).With(CommandBehavior.CloseConnection).Will(Return.Value(mockDbDataReader));
			Expect.On(mockDbDataReader).One.Method(x => x.Dispose());
			Expect.On(mockDbCommand).One.SetProperty(x => x.CommandTimeout).To(15);
			Expect.On(mockDbCommand).One.Method(x => x.Prepare());

			adoNetYieldingFascade = new AdoNetYieldingFascade(mockReflectionFascade);

			dbDataReader = adoNetYieldingFascade.ExecuteReader(mockDbConnection, null, CommandType.Text, "blah blah blah", null, CommandBehavior.CloseConnection, 15, true);

			Assert.IsNotNull(dbDataReader);

			dbDataReader.Dispose();

			mockFactory.VerifyAllExpectationsHaveBeenMet();
		}
开发者ID:textmetal,项目名称:main,代码行数:39,代码来源:AdoNetYieldingFascadeTests.cs

示例14: ShouldInferDbTypeForClrTypeTest

		public void ShouldInferDbTypeForClrTypeTest()
		{
			IAdoNetYieldingFascade adoNetYieldingFascade;
			MockFactory mockFactory;
			IReflectionFascade mockReflectionFascade;

			DbType dbType;

			mockFactory = new MockFactory();
			mockReflectionFascade = mockFactory.CreateInstance<IReflectionFascade>();

			adoNetYieldingFascade = new AdoNetYieldingFascade(mockReflectionFascade);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Boolean));
			Assert.AreEqual(DbType.Boolean, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Byte));
			Assert.AreEqual(DbType.Byte, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(DateTime));
			Assert.AreEqual(DbType.DateTime, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(DateTimeOffset));
			Assert.AreEqual(DbType.DateTimeOffset, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Decimal));
			Assert.AreEqual(DbType.Decimal, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Double));
			Assert.AreEqual(DbType.Double, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Guid));
			Assert.AreEqual(DbType.Guid, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Int16));
			Assert.AreEqual(DbType.Int16, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Int32));
			Assert.AreEqual(DbType.Int32, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Int64));
			Assert.AreEqual(DbType.Int64, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(SByte));
			Assert.AreEqual(DbType.SByte, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Single));
			Assert.AreEqual(DbType.Single, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(UInt16));
			Assert.AreEqual(DbType.UInt16, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(UInt32));
			Assert.AreEqual(DbType.UInt32, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(UInt64));
			Assert.AreEqual(DbType.UInt64, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Byte[]));
			Assert.AreEqual(DbType.Binary, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Object));
			Assert.AreEqual(DbType.Object, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(UInt64));
			Assert.AreEqual(DbType.UInt64, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(DbType));
			Assert.AreEqual(DbType.Int32, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(Int32?));
			Assert.AreEqual(DbType.Int32, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(String));
			Assert.AreEqual(DbType.String, dbType);

			dbType = adoNetYieldingFascade.InferDbTypeForClrType(typeof(String).MakeByRefType());
			Assert.AreEqual(DbType.String, dbType);
		}
开发者ID:textmetal,项目名称:main,代码行数:79,代码来源:AdoNetYieldingFascadeTests.cs

示例15: ShouldMakeNullableTypeTest

		public void ShouldMakeNullableTypeTest()
		{
			ReflectionFascade reflectionFascade;
			Type conversionType;
			Type nullableType;

			MockFactory mockFactory;
			IDataTypeFascade mockDataTypeFascade;

			mockFactory = new MockFactory();
			mockDataTypeFascade = mockFactory.CreateInstance<IDataTypeFascade>();

			reflectionFascade = new ReflectionFascade(mockDataTypeFascade);

			conversionType = typeof(int);
			nullableType = reflectionFascade.MakeNullableType(conversionType);
			Assert.AreEqual(typeof(int?), nullableType);

			conversionType = typeof(int?);
			nullableType = reflectionFascade.MakeNullableType(conversionType);
			Assert.AreEqual(typeof(int?), nullableType);

			conversionType = typeof(IDisposable);
			nullableType = reflectionFascade.MakeNullableType(conversionType);
			Assert.AreEqual(typeof(IDisposable), nullableType);
		}
开发者ID:textmetal,项目名称:main,代码行数:26,代码来源:ReflectionFascadeTests.cs


注:本文中的MockFactory.CreateInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。