public void PropertyContainer_Construct_NullSrcContainerShouldGiveUnderstandableErrorMessage()
        {
            var src = (CustomDataFoo)null;
            var dst = new CustomDataFoo();

            var ex = Assert.Throws <ArgumentNullException>(() => PropertyContainer.Construct(ref dst, ref src));

            Assert.That(ex.ParamName, Is.EqualTo("srcContainer"));
            Assert.That(ex.Message, Is.EqualTo("Value cannot be null." + Environment.NewLine + "Parameter name: srcContainer"));
        }
コード例 #2
0
        public void PropertyContainer_Transfer_NullDstContainerShouldGiveUnderstandableErrorMessage()
        {
            var           src = new CustomDataFoo();
            CustomDataFoo dst = null;

            var ex = Assert.Throws <ArgumentNullException>(() => PropertyContainer.Transfer(dst, src));

            Assert.That(ex.ParamName, Is.EqualTo("dstContainer"));
            Assert.That(ex.Message, Is.EqualTo("Value cannot be null." + Environment.NewLine +
                                               "Parameter name: dstContainer"));
        }
コード例 #3
0
        public void ShouldGiveUnderstandableErrorMessageWhenPassingNullDestinationByRef()
        {
            var           src = new CustomDataFoo();
            CustomDataFoo dst = null;

            var ex = Assert.Throws <ArgumentNullException>(() => PropertyContainer.Transfer(ref dst, ref src));

            Assert.That(ex.ParamName, Is.EqualTo("destination"));
            Assert.That(ex.Message, Is.EqualTo("Value cannot be null." + Environment.NewLine +
                                               "Parameter name: destination"));
        }