Example #1
0
 public void ReplacedContextReturnsCorrectValue()
 {
     var expected = new TestingContext();
     TaskContext.Default = expected;
     var actual = TaskContext.Default;
     Assert.AreSame(expected, actual);
 }
Example #2
0
 public void DoubleAssignmentShouldThrow()
 {
     var expected = new TestingContext();
     TaskContext.Default = expected;
     Assert.Throws<InvalidOperationException>(() => TaskContext.Default = expected);
     var actual = TaskContext.Default;
     Assert.AreSame(expected, actual);
 }
Example #3
0
        public void DoubleAssignmentShouldThrow()
        {
            var expected = new TestingContext();

            TaskContext.Default = expected;
            Assert.Throws <InvalidOperationException>(() => TaskContext.Default = expected);
            var actual = TaskContext.Default;

            Assert.AreSame(expected, actual);
        }
Example #4
0
 public void ResetToDefault()
 {
     var expected = new TestingContext();
     TaskContext.Default = expected;
     var actual = TaskContext.Default;
     Assert.AreSame(expected, actual);
     TaskContext.ResetToDefault();
     actual = TaskContext.Default;
     Assert.AreNotSame(expected, actual);
     Assert.IsInstanceOfType<DefaultTaskContext>(actual);
 }
Example #5
0
        public void ResetToDefault()
        {
            var expected = new TestingContext();

            TaskContext.Default = expected;
            var actual = TaskContext.Default;

            Assert.AreSame(expected, actual);
            TaskContext.ResetToDefault();
            actual = TaskContext.Default;
            Assert.AreNotSame(expected, actual);
            Assert.IsInstanceOfType <DefaultTaskContext>(actual);
        }