コード例 #1
0
        public void ConstructObject_GivenType_ShouldNotThrowExceptionAndConstructObject()
        {
            //---------------Set up test pack-------------------
            FakeTestClass testClass = null;

            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => testClass = (FakeTestClass)ConstructorTestHelper.ConstructObject(typeof(FakeTestClass)));
            //---------------Test Result -----------------------
            testClass.Should().NotBeNull();
        }
コード例 #2
0
        public void ConstructObject_GivenGenericType_ShouldNotThrowExceptionAndConstructObjectWithValuesAsExpected(string propertyName, Type expectedType)
        {
            //---------------Set up test pack-------------------
            FakeTestClass testClass = null;

            //---------------Assert Precondition----------------
            //---------------Execute Test ----------------------
            Assert.DoesNotThrow(() => testClass = ConstructorTestHelper.ConstructObject <FakeTestClass>());
            //---------------Test Result -----------------------
            testClass.Should().NotBeNull();

            var propertyValue = testClass.GetPropertyValue(propertyName);

            propertyValue.Should().NotBeNull();
            propertyValue.Should().BeOfType(expectedType);
        }