Beispiel #1
0
        public void TestReAssignment()
        {
            SpecialString s = "Microsoft";

            Assert.That(s.ToString(), Is.EqualTo("Microsoft"));
            s = "RandomString";
            Assert.That(s.ToString(), Is.EqualTo("RandomString"));
            s = "1";
            Assert.That(s.ToString(), Is.EqualTo("1"));
        }
Beispiel #2
0
        public void InputIsEmpty()
        {
            SpecialString s1 = "", s2 = "";

            Assert.That(s1 == s2, Is.True, "Empty strings should be equal.");
            Assert.That(s1 != s2, Is.False, "Empty strings should be equal.");
            Assert.That(() => s1 << 2, Throws.InvalidOperationException, "Should not be possible to perform shift on strings with higher steps than characters.");
            Assert.That(() => s1 >> 2, Throws.InvalidOperationException, "Should not be possible to perform shift on strings with higher steps than characters.");
            Assert.That(s1 << 0, Is.EqualTo(s1), "Should be possible to perform shift on strings with equal steps and characters.");
            Assert.That(s1 >> 0, Is.EqualTo(s1), "Should be possible to perform shift on strings with equal steps and characters.");
            Assert.That(s1.ToString(), Is.Empty, "Should return an empty string.");
        }