public void Test_Construct_ShouldConstruct()
 {
     //---------------Set up test pack-------------------
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     PropertyDescriptor propDescriptor = new PropertyDescriptorID();
     //---------------Test Result -----------------------
     Assert.IsNotNull(propDescriptor);           
 }
 public void Test_DisplayName_ShouldBeGridColumnPropertyName()
 {
     //---------------Set up test pack-------------------
     PropertyDescriptor propDescriptor = new PropertyDescriptorID();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var actualDisplayName = propDescriptor.DisplayName;
     //---------------Test Result -----------------------
     Assert.AreEqual("HABANERO_OBJECTID", actualDisplayName);
 }
        public void Test_Construct_ShouldConstruct()
        {
            //---------------Set up test pack-------------------
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            PropertyDescriptor propDescriptor = new PropertyDescriptorID();

            //---------------Test Result -----------------------
            Assert.IsNotNull(propDescriptor);
        }
        public void Test_IsReadOnly_ShouldReturnTrue()
        {
            //---------------Set up test pack-------------------
            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var isReadOnly = propDescriptor.IsReadOnly;

            //---------------Test Result -----------------------
            Assert.IsTrue(isReadOnly, "ID Descriptor should always be read only");
        }
        public void Test_ComponentType_ShouldReturnIBusinessObject()
        {
            //---------------Set up test pack-------------------
            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var componentType = propDescriptor.ComponentType;

            //---------------Test Result -----------------------
            Assert.AreSame(typeof(IBusinessObject), componentType);
        }
        public void Test_DisplayName_ShouldBeGridColumnPropertyName()
        {
            //---------------Set up test pack-------------------
            PropertyDescriptor propDescriptor = new PropertyDescriptorID();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var actualDisplayName = propDescriptor.DisplayName;

            //---------------Test Result -----------------------
            Assert.AreEqual("HABANERO_OBJECTID", actualDisplayName);
        }
        public void Test_Width_ShouldReturnWidthFromColumn()
        {
            //---------------Set up test pack-------------------
            const int            expectedWidth  = 0;
            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var width = propDescriptor.Width;

            //---------------Test Result -----------------------
            Assert.AreEqual(expectedWidth, width);
        }
        public void Test_LookupList_ShouldBeNull()
        {
            //---------------Set up test pack-------------------

            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            ILookupList lookupList = propDescriptor.LookupList;

            //---------------Test Result -----------------------
            Assert.IsNull(lookupList);
        }
        public void Test_PropertyType_ShouldReturnObject()
        {
            //---------------Set up test pack-------------------
            Type expectedPropType = typeof(object);
            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var propertyType = propDescriptor.PropertyType;

            //---------------Test Result -----------------------
            Assert.AreEqual(expectedPropType, propertyType);
        }
        public void Test_CanResetValue_ShouldReturnFalse()
        {
            //---------------Set up test pack-------------------
            var propDescriptor = new PropertyDescriptorID();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var canResetValue = propDescriptor.CanResetValue(new FakeBO());

            //---------------Test Result -----------------------
            Assert.IsFalse(canResetValue);
        }
        public void Test_Alignment_ShouldReturnAlignmentFromColumn()
        {
            //---------------Set up test pack-------------------
            const PropAlignment  expectedAlignment = PropAlignment.left;
            PropertyDescriptorID propDescriptor    = new PropertyDescriptorID();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            var alignment = propDescriptor.Alignment;

            //---------------Test Result -----------------------
            Assert.AreEqual(expectedAlignment, alignment);
        }
        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_SetValue_ShouldRaiseError()
        {
            //---------------Set up test pack-------------------
            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            FakeBO fakeBO = new FakeBO {
                FakeBOName = RandomValueGen.GetRandomString()
            };

            //---------------Assert Precondition----------------
            Assert.IsNotNullOrEmpty(fakeBO.FakeBOName);
            //---------------Execute Test ----------------------
            var expectedValue = RandomValueGen.GetRandomString();

            try
            {
                propDescriptor.SetValue(fakeBO, expectedValue);
                Assert.Fail("Expected to throw an HabaneroDeveloperException");
            }
            //---------------Test Result -----------------------
            catch (HabaneroDeveloperException ex)
            {
                StringAssert.Contains("The PropertyDescriptorID cannot set value since the objectID is ReadOnly", ex.Message);
            }
        }
 public void Test_ComponentType_ShouldReturnIBusinessObject()
 {
     //---------------Set up test pack-------------------
     PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var componentType = propDescriptor.ComponentType;
     //---------------Test Result -----------------------
     Assert.AreSame(typeof(IBusinessObject), componentType);
 }
 public void Test_SetValue_ShouldRaiseError()
 {
     //---------------Set up test pack-------------------
     PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
     FakeBO fakeBO = new FakeBO { FakeBOName = RandomValueGen.GetRandomString() };
     //---------------Assert Precondition----------------
     Assert.IsNotNullOrEmpty(fakeBO.FakeBOName);
     //---------------Execute Test ----------------------
     var expectedValue = RandomValueGen.GetRandomString();
     try
     {
         propDescriptor.SetValue(fakeBO, expectedValue);
         Assert.Fail("Expected to throw an HabaneroDeveloperException");
     }
         //---------------Test Result -----------------------
     catch (HabaneroDeveloperException ex)
     {
         StringAssert.Contains("The PropertyDescriptorID cannot set value since the objectID is ReadOnly", 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_PropertyType_ShouldReturnObject()
 {
     //---------------Set up test pack-------------------
     Type expectedPropType = typeof(object);
     PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var propertyType = propDescriptor.PropertyType;
     //---------------Test Result -----------------------
     Assert.AreEqual(expectedPropType, propertyType);
 }
 public void Test_Width_ShouldReturnWidthFromColumn()
 {
     //---------------Set up test pack-------------------
     const int expectedWidth = 0;
     PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var width = propDescriptor.Width;
     //---------------Test Result -----------------------
     Assert.AreEqual(expectedWidth, width);
 }
        public void Test_LookupList_ShouldBeNull()
        {
            //---------------Set up test pack-------------------

            PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            ILookupList lookupList = propDescriptor.LookupList;
            //---------------Test Result -----------------------
            Assert.IsNull(lookupList);
        }
        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_IsReadOnly_ShouldReturnTrue()
 {
     //---------------Set up test pack-------------------
     PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var isReadOnly = propDescriptor.IsReadOnly;
     //---------------Test Result -----------------------
     Assert.IsTrue(isReadOnly, "ID Descriptor should always be read only");
 }
 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_Alignment_ShouldReturnAlignmentFromColumn()
 {
     //---------------Set up test pack-------------------
     const PropAlignment expectedAlignment = PropAlignment.left;
     PropertyDescriptorID propDescriptor = new PropertyDescriptorID();
     //---------------Assert Precondition----------------
     //---------------Execute Test ----------------------
     var alignment = propDescriptor.Alignment;
     //---------------Test Result -----------------------
     Assert.AreEqual(expectedAlignment, alignment);
 }
        public void Test_CanResetValue_ShouldReturnFalse()
        {
            //---------------Set up test pack-------------------
            var propDescriptor = new PropertyDescriptorID();
            //---------------Assert Precondition----------------

            //---------------Execute Test ----------------------
            var canResetValue = propDescriptor.CanResetValue(new FakeBO());
            //---------------Test Result -----------------------
            Assert.IsFalse(canResetValue);
        }