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); }
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); }
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); }