コード例 #1
0
        public void UIATestObject_SetContext()
        {
            UIATestObject testObject = new UIATestObject();

            testObject.SetContext(new MockContextClass()
            {
                ContextName = "MockContext1"
            });
            testObject.SetContext(new MockContextClass2()
            {
                ContextName = "MockContext2"
            });

            MockContextClass  context  = testObject.GetContext <MockContextClass>();
            MockContextClass2 context2 = testObject.GetContext <MockContextClass2>();

            Assert.AreEqual("MockContext1", context.ContextName);
            Assert.AreEqual("MockContext2", context2.ContextName);
        }
コード例 #2
0
        public void TestObjectNurse_ctor()
        {
            UIATestObject testObject = new UIATestObject();

            testObject.NodeName    = "MyTestObject";
            testObject.ControlType = ControlType.CheckBox;
            TestObjectNurse nurseObject = new TestObjectNurse(testObject);


            Assert.AreEqual(testObject.NodeName, nurseObject.NodeName);
            Assert.AreEqual(testObject.ControlTypeString, nurseObject.ControlTypeString);
            string displayName = testObject.ControlTypeString + ": " + testObject.NodeName;

            Assert.AreEqual(displayName, nurseObject.TreeNode.Text);

            CachedPropertyGroup cachedGroup = new CachedPropertyGroup();

            cachedGroup.Properties[UIAControlKeys.ImagePath] = "pathToImage.png";
            testObject.SetContext <CachedPropertyGroup>(cachedGroup);

            TestObjectNurse nurseObject2 = new TestObjectNurse(testObject);

            Assert.AreEqual("pathToImage.png", nurseObject2.ImageFile);
        }