public void TestMessageTooLong() { int maxMessageLength = KuduStatus.MaxMessageLength; string abbreviation = KuduStatus.Abbreviation; int abbreviationLength = abbreviation.Length; // Test string that will not get abbreviated. var str = new string('a', maxMessageLength); var status = KuduStatus.Corruption(str); Assert.Equal(str, status.Message); // Test string just over the limit that will get abbreviated. str = new string('a', maxMessageLength + 1); status = KuduStatus.Corruption(str); Assert.Equal(maxMessageLength, status.Message.Length); Assert.Equal( status.Message.Substring(maxMessageLength - abbreviationLength), abbreviation); // Test string that's way too big that will get abbreviated. str = new string('a', maxMessageLength * 2); status = KuduStatus.Corruption(str); Assert.Equal(maxMessageLength, status.Message.Length); Assert.Equal( status.Message.Substring(maxMessageLength - abbreviationLength), abbreviation); }