コード例 #1
0
		public void SwapDoesIndeedReturnTheOldTarget()
		{
			HotSwappableTargetSource source = new HotSwappableTargetSource(this);
			object foo = source.Swap(new SideEffectObject());
			Assert.IsTrue(object.ReferenceEquals(this, foo),
				"Swap() is not returning the old target.");
		}
コード例 #2
0
		public void RejectsSwapToNull()
		{
			HotSwappableTargetSource source = new HotSwappableTargetSource(null);
			source.Swap(null);
		}
コード例 #3
0
		public void RejectsSwapToNull()
		{
			HotSwappableTargetSource source = new HotSwappableTargetSource(null);
            Assert.Throws<ArgumentNullException>(() => source.Swap(null));
		}
コード例 #4
0
		public void InstantiationWithInitialTarget()
		{
			HotSwappableTargetSource source = new HotSwappableTargetSource(this);
			object foo = source.GetTarget();
			Assert.IsTrue(object.ReferenceEquals(this, foo),
				"Ctor is not storing the supplied target.");
		}
コード例 #5
0
        public void RejectsSwapToNull()
        {
            HotSwappableTargetSource source = new HotSwappableTargetSource(null);

            source.Swap(null);
        }