Exemplo n.º 1
0
        public void LineParser_Parse()
        {
            var options = new SnapshotOptions();

            options.AddDirective(line => line.Replace(" ", string.Empty, StringComparison.OrdinalIgnoreCase));


            var sn = new StringBuilder()
                     .AppendLine("Line 1")
                     .AppendLine("Line 2")
                     .AppendLine("Line 3");

            var savedsnap = SnapshotTokenizer.Tokenize(sn.ToString(), options);

            sn = new StringBuilder()
                 .AppendLine("Line    1")
                 .AppendLine("   Line 2")
                 .AppendLine("  Line     3");

            var newsnap = SnapshotTokenizer.Tokenize(sn.ToString());

            var comparer = new SnapshotCompare();
            var result   = comparer.Compare(newsnap, savedsnap, options);

            result.Status.Should().Be(SnapshotStatus.SnapshotsDoNotMatch);


            newsnap = SnapshotTokenizer.Tokenize(sn.ToString(), options);
            result  = comparer.Compare(newsnap, savedsnap, options);
            result.Status.Should().Be(SnapshotStatus.SnapshotsMatch);
        }