Esempio n. 1
0
        public void VersionedStringBuilder_IsInitializedToSpecifiedString()
        {
            var builder = new VersionedStringBuilder("Hello, world!");

            TheResultingValue(builder.Version).ShouldBe(0);
            TheResultingString(builder.ToString()).ShouldBe("Hello, world!");
        }
Esempio n. 2
0
        public void VersionedStringBuilder_VersionIsNotIncremented_WhenAppendVersionedStringBuilderIsCalled_AndValueIsNull()
        {
            var builder = new VersionedStringBuilder("Hello, world!");

            builder.Append((VersionedStringBuilder)null);

            TheResultingValue(builder.Version).ShouldBe(0);
            TheResultingString(builder.ToString()).ShouldBe("Hello, world!");
        }
Esempio n. 3
0
        public void VersionedStringBuilder_VersionIsIncremented_WhenClearIsCalled()
        {
            var builder = new VersionedStringBuilder("Hello, world!");

            builder.Clear();

            TheResultingValue(builder.Version).ShouldBe(1);
            TheResultingString(builder.ToString()).ShouldBe(String.Empty);
        }
Esempio n. 4
0
        public void VersionedStringBuilder_VersionIsIncremented_WhenAppendVersionedStringBuilderIsCalled()
        {
            var builder = new VersionedStringBuilder("Hello, world!");

            var value = new VersionedStringBuilder(" Goodbye, world!");

            builder.Append(value);

            TheResultingValue(builder.Version).ShouldBe(1);
            TheResultingString(builder.ToString()).ShouldBe("Hello, world! Goodbye, world!");
        }
Esempio n. 5
0
        public void VersionedStringBuilder_VersionIsIncremented_WhenInsertCharIsCalled()
        {
            var builder = new VersionedStringBuilder("Hello, world!");

            var value = '!';

            builder.Insert(12, value);

            TheResultingValue(builder.Version).ShouldBe(1);
            TheResultingString(builder.ToString()).ShouldBe("Hello, world!!");
        }
Esempio n. 6
0
        public void VersionedStringBuilder_VersionIsNotIncremented_WhenInsertVersionedStringSourceIsCalled_WithInvalidSource()
        {
            var builder = new VersionedStringBuilder("Hello, world!");

            var value = new VersionedStringSource();

            builder.Insert(5, value);

            TheResultingValue(builder.Version).ShouldBe(0);
            TheResultingString(builder.ToString()).ShouldBe("Hello, world!");
        }
Esempio n. 7
0
        public void VersionedStringBuilder_VersionIsIncremented_WhenInsertVersionedStringBuilderIsCalled()
        {
            var builder = new VersionedStringBuilder("Hello, world!");

            var value = new VersionedStringBuilder(" and goodbye");

            builder.Insert(5, value);

            TheResultingValue(builder.Version).ShouldBe(1);
            TheResultingString(builder.ToString()).ShouldBe("Hello and goodbye, world!");
        }