Example #1
0
        public void CreateWithReference()
        {
            TestHelpers.EnsureLanguageIsValid();
            string reference = "Something";
            BadReferenceException exception = new BadReferenceException(reference);

            Assert.AreEqual("Reference 'Something' is either incorrect or missing.", exception.Message);
            Assert.AreEqual(reference, exception.Reference);
        }
Example #2
0
        public void CreateWithReferenceAndMessage()
        {
            TestHelpers.EnsureLanguageIsValid();
            string reference = "Something";
            string message   = "An error has occured";
            BadReferenceException exception = new BadReferenceException(reference, message);

            Assert.AreEqual(message, exception.Message);
            Assert.AreEqual(reference, exception.Reference);
        }
Example #3
0
        public void PassThroughSerialisation()
        {
            TestHelpers.EnsureLanguageIsValid();
            string reference = "Something";
            BadReferenceException exception = new BadReferenceException(reference);
            object result = TestHelpers.RunSerialisationTest(exception);

            Assert.IsNotNull(result);
            Assert.IsInstanceOf <BadReferenceException>(result);
            Assert.AreEqual("Reference 'Something' is either incorrect or missing.", (result as BadReferenceException).Message);
            Assert.AreEqual(reference, (result as BadReferenceException).Reference);
        }