示例#1
0
        public void Initialize_RegisteredInstances_ShouldSucceed()
        {
            ContextTests instanceOne = new ContextTests();
            ContextTests instanceTwo = new ContextTests();

            Context.Register(this);
            Context.Register(instanceOne);
            Context.Register(instanceTwo);

            Context.Initialize();
            Context.Invoke();

            Assert.True(ContextTests.DefaultFieldsEqual(this));
            Assert.True(ContextTests.DefaultFieldsEqual(instanceOne));
            Assert.True(ContextTests.DefaultFieldsEqual(instanceTwo));
        }
示例#2
0
        public void Initialize_SpecificInstance_ShouldSucceed()
        {
            Context.Initialize(this);

            Assert.True(ContextTests.DefaultFieldsEqual(this));
        }
示例#3
0
 // HACK: Because Context is static, we reset the instance before each test.
 public ContextTests()
 {
     ContextTests.PerformReset();
 }
示例#4
0
 private static bool DefaultFieldsEqual(ContextTests instance)
 {
     return(StrKnowns.Default.Equals(instance.StrAttribute) &&
            DblKnowns.Default.Equals(instance.DblAttribute.ToString()) &&
            IntKnowns.Default.Equals(instance.IntAttribute.ToString()));
 }