예제 #1
0
        public void ProcessRequest(HttpContext context)
        {
            ObjectionStore objectionStore = new ObjectionStore(
                new CachingImplementationResolver(new NMockAwareImplementationResolver(), new CachedTypeMap(context.Cache, RESOLVED_TYPE_MAP)),
                new MaxLengthConstructorSelectionStrategy());
            ObjectSource objectSource = new CruiseObjectSourceInitializer(objectionStore).SetupObjectSourceForRequest(context);

            context.Response.AppendHeader("X-CCNet-Version",
                string.Format(System.Globalization.CultureInfo.CurrentCulture,"CruiseControl.NET/{0}", Assembly.GetExecutingAssembly().GetName().Version));
            Assembly.GetExecutingAssembly().GetName().Version.ToString();

            IResponse response = ((RequestController)objectSource.GetByType(typeof(RequestController))).Do();
            response.Process(context.Response);
        }
		public void TestSomething()
		{
			SimpleDependency dependency = new SimpleDependency("Hello NetReflector");
			ObjectionStore objectionStore = new ObjectionStore();
			objectionStore.AddInstanceForType(typeof(SimpleDependency), dependency);

			string serializedForm = @"<mySerializableType myProperty=""MyValue"" />";

			NetReflectorTypeTable typeTable = NetReflectorTypeTable.CreateDefault(new ObjectionNetReflectorInstantiator(objectionStore));

			SerializableType deserialized = (SerializableType) NetReflector.Read(serializedForm, typeTable);

			Assert.AreEqual("MyValue", deserialized.MyProperty);
			Assert.IsNotNull("Hello NetReflector", deserialized.DependencyObject.Message);
		}
		public void ShouldBeAbleToMarkNMockClassesAsIgnoredForImplementationResolution()
		{
			NMockAwareImplementationResolver resolver = new NMockAwareImplementationResolver();
			resolver.IgnoreNMockImplementations = true;
			store = new ObjectionStore(resolver, new MaxLengthConstructorSelectionStrategy());
			Assert.IsTrue(store.GetByType(typeof(InterfaceForIgnoring)) is InterfaceForIgnoringImpl);

		}
		public void Setup()
		{
			store = new ObjectionStore();
			testObject = new TestClass();
		}