public void Test_GetValue_ShouldGetValueFromBO()
        {
            //---------------Set up test pack-------------------
            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            FakeBO fakeBO = new FakeBO {
                FakeBOName = RandomValueGen.GetRandomString()
            };

            //---------------Assert Precondition----------------
            Assert.IsNotNull(fakeBO.ID.ObjectID);
            //---------------Execute Test ----------------------
            var actualValue = propDescriptor.GetValue(fakeBO);

            //---------------Test Result -----------------------
            Assert.AreEqual(fakeBO.ID.ObjectID, actualValue);
        }
        public void Test_GetValue_WhenComponentNotCorrectType_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            try
            {
                propDescriptor.GetValue(100);
                Assert.Fail("Expected to throw an InvalidCastException");
            }
            //---------------Test Result -----------------------
            catch (InvalidCastException ex)
            {
                StringAssert.Contains("You cannot GetValue since the component is not of type ", ex.Message);
            }
        }
        public void Test_GetValue_WhenComponentNull_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            object x = null;

            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            try
            {
                propDescriptor.GetValue(x);
                Assert.Fail("Expected to throw an ArgumentNullException");
            }
            //---------------Test Result -----------------------
            catch (ArgumentNullException ex)
            {
                StringAssert.Contains("component", ex.ParamName);
                StringAssert.Contains("Value cannot be null.", ex.Message);
            }
        }
        public void Test_GetValue_WhenComponentNull_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            object x = null;
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            try
            {
                propDescriptor.GetValue(x);
                Assert.Fail("Expected to throw an ArgumentNullException");
            }
            //---------------Test Result -----------------------
            catch (ArgumentNullException ex)
            {
                StringAssert.Contains("component", ex.ParamName);
                StringAssert.Contains("Value cannot be null.", ex.Message);
            }
        }
        public void Test_GetValue_WhenComponentNotCorrectType_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            try
            {
                propDescriptor.GetValue(100);
                Assert.Fail("Expected to throw an InvalidCastException");
            }
            //---------------Test Result -----------------------
            catch (InvalidCastException ex)
            {
                StringAssert.Contains("You cannot GetValue since the component is not of type ", ex.Message);
            }
        }
 public void Test_GetValue_ShouldGetValueFromBO()
 {
     //---------------Set up test pack-------------------
     PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
     FakeBO fakeBO = new FakeBO { FakeBOName = RandomValueGen.GetRandomString() };
     //---------------Assert Precondition----------------
     Assert.IsNotNull(fakeBO.ID.ObjectID);
     //---------------Execute Test ----------------------
     var actualValue = propDescriptor.GetValue(fakeBO);
     //---------------Test Result -----------------------
     Assert.AreEqual(fakeBO.ID.ObjectID, actualValue);
 }