コード例 #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()));
 }