示例#1
0
        public void Test_SetValue_Fail_ReadOnly_False()
        {
            //---------------Set up test pack-------------------
            MyBoAuthenticationStub.LoadDefaultClassDef_ReadOnlyProp1();

            MyBoAuthenticationStub myBoStub = new MyBoAuthenticationStub();
            BOProp prop1 = (BOProp)myBoStub.Props["Prop1"];

            //---------------Assert Precondition----------------
            string message;

            Assert.IsFalse(prop1.IsEditable(out message));

            //---------------Execute Test ----------------------
            const string newPropValue = "1112";

            try
            {
                prop1.Value = newPropValue;
                Assert.Fail("expected Err");
            }
            //---------------Test Result -----------------------
            catch (BOPropWriteException ex)
            {
                StringAssert.Contains
                    ("The property 'MyBoAuthenticationStub.Prop 1' is not editable since it is set up as ReadOnly", ex.Message);
            }
        }