public void GetArrayPropertiesInSelection()
        {
            var code = @"
using System;

namespace tests
{
    class Class1
    {
       ☆ public bool MyBool { get; set; }
        public bool[] MyBoolBrackets { get; set; }
        public Array<bool> MyArrayBool { get; set; }☆
    }
}";

            var expectedXaml = "<Bool />"
                               + Environment.NewLine + "<BoolBrackets />"
                               + Environment.NewLine + "<ArrayBool />";

            var expected = new ParserOutput
            {
                Name       = "MyBool, MyBoolBrackets and 1 other member",
                Output     = expectedXaml,
                OutputType = ParserOutputType.Selection,
            };

            this.SelectionBetweenStarsShouldProduceExpected(code, expected, this.ArrayTestsProfile);
        }
 public ExecuteAtParseTimeData(ParserOutput parserOutput, Section section, Chord chord, LocatedString locatedName)
 {
     ParserOutput = parserOutput;
     Section      = section;
     Chord        = chord;
     LocatedName  = locatedName;
 }
        public void GetArrayPropertiesInClass()
        {
            var code = @"
using System;

namespace tests
{
    class Cla☆ss1
    {
        public bool MyBool { get; set; }
        public bool[] MyBoolBrackets { get; set; }
        public Array<bool> MyArrayBool { get; set; }
    }
}";

            var expectedXaml = "<Bool />"
                               + Environment.NewLine + "<BoolBrackets />"
                               + Environment.NewLine + "<ArrayBool />";

            var expected = new ParserOutput
            {
                Name       = "Class1",
                Output     = expectedXaml,
                OutputType = ParserOutputType.Class,
            };

            this.PositionAtStarShouldProduceExpected(code, expected, this.ArrayTestsProfile);
        }
        public void Fallback_OneAttributeOneFallback()
        {
            var code = @"
namespace tests
{
    class Class1
    {
        [Display(Name = ""ShortName"")]
        public ☆string UserName { get; set; }
    }
}";

            var expectedOutput = "<TextBox Text=\"User Name\" Header=\"ShortName\" />";

            var expected = new ParserOutput
            {
                Name       = "UserName",
                Output     = expectedOutput,
                OutputType = ParserOutputType.Member,
            };

            var profile = this.displayNameProfile;

            profile.FallbackOutput = "<TextBox Text=\"$namewithspaces$\" $att:Display: Header=\"[Name]\"::Header=\"@namewithspaces@\"$ />";

            this.PositionAtStarShouldProduceExpected(code, expected, profile);
        }
Beispiel #5
0
        public void ResolveIncludes(ParserOutput parserOutput)
        {
            switch (_includeState)
            {
            case MyIncludeState.Idle:
                _includeState = MyIncludeState.Running;
                foreach (var name in _includes)
                {
                    var mode = parserOutput.Modes.Find(z => z.Name == name);
                    if (mode == null)
                    {
                        throw new ParseException($"Cannot find mode '{name}' (an include of mode '{Name}').");
                    }
                    if (mode.IsComposeMode != IsComposeMode)
                    {
                        throw new ParseException($"Cannot include mode '{name}' in mode '{Name}' as they are not of the same kind.");
                    }
                    mode.ResolveIncludes(parserOutput);
                    foreach (var hotkey in mode._hotkeys)
                    {
                        AddHotkey(hotkey, mode._hasAmbiguousChord);
                    }
                }
                _includeState = MyIncludeState.Done;
                break;

            case MyIncludeState.Running:
                throw new ParseException($"Cyclic include detected at mode '{Name}'.");
            }
        }
        public void GetPropertyWithBackingField()
        {
            var code = @"
namespace tests
{
    class Class1
    {
        private string _property2;

        public string Property1 { get; set; }

        ☆public string Property2 { get => _property2; set => _property2 = value; }
☆
        public string Property3 { get; set; }
    }
}";

            var expected = new ParserOutput
            {
                Name       = "Property2",
                Output     = "<TextBox Text=\"{x:Bind Property2, Mode=TwoWay}\" />",
                OutputType = ParserOutputType.Property,
            };

            this.EachPositionBetweenStarsShouldProduceExpected(code, expected);
        }
Beispiel #7
0
        public void GetPropertyWithBackingFieldAndPrivateSetter()
        {
            var code = @"
Namespace tests

    Class Class1

        Private _property2 As String

        Public Property Property1 As String

        Pub☆lic Property Property2 As String
            Get
                Return _property2
            End Get

            Private Set(ByVal value As String)
                _property2 = value
            End Set
        End Property☆

        Public Property Property3 As String
    End Class
End Namespace";

            var expected = new ParserOutput
            {
                Name       = "Property2",
                Output     = "<TextBlock Text=\"Property2\" />",
                OutputType = ParserOutputType.Property,
            };

            this.EachPositionBetweenStarsShouldProduceExpected(code, expected);
        }
        public void GetPropertyWithBackingFieldAndNoSetter()
        {
            var code = @"
Namespace tests

    Class Class1

        Private _property2 As String = ""somevalue""

        Public Property Property1 As String

        ☆Public ReadOnly Property Property2 As String
            Get
                Return _property2
            End Get
        End Property
☆
        Public Property Property3 As String
    End Class
End Namespace";

            var expected = new ParserOutput
            {
                Name       = "Property2",
                Output     = "<TextBlock Text=\"Property2\" />",
                OutputType = ParserOutputType.Member,
            };

            this.EachPositionBetweenStarsShouldProduceExpected(code, expected);
        }
        public void GetCustomProperty()
        {
            var code = @"
namespace tests
{
    class Class1
    {
        ☆public Order LastOrder { get; set; }☆
    }

    class Order
    {
        public int OrderId { get; set; }
        public string OrderDescription { get; set; }
    }
}";

            var expected = new ParserOutput
            {
                Name   = "LastOrder",
                Output = @"<Slider Minimum=""0"" Maximum=""100"" x:Name=""LastOrder.OrderId"" Value=""{x:Bind LastOrder.OrderId, Mode=TwoWay}"" />"
                         + Environment.NewLine + @"<TextBox Text=""{x:Bind LastOrder.OrderDescription, Mode=TwoWay}"" />",
                OutputType = ParserOutputType.Property,
            };

            this.EachPositionBetweenStarsShouldProduceExpected(code, expected);
        }
Beispiel #10
0
        public void GetSelectionDoesNotIncludeExcludedProperties()
        {
            var code = @"
Public Class Class1
        Private _property8 As String    ☆

        Public Property Property1 As String
        Public ReadOnly IsInDesignMode Property2 As Boolean
        Public Static Property IsInDesignModeStatic As Boolean
            Get
                Return _property8
            End Get
            Set
                _property8 = value
            End Set
        End Property☆
End Class";

            var expectedOutput = "<TextBox Text=\"{x:Bind Property1, Mode=TwoWay}\" />";

            var expected = new ParserOutput
            {
                Name       = "Property1",
                Output     = expectedOutput,
                OutputType = ParserOutputType.Selection,
            };

            this.SelectionBetweenStarsShouldProduceExpected(code, expected);
        }
Beispiel #11
0
        public void GetSelectionWithDynamicProperty()
        {
            var profile = TestProfile.CreateEmpty();

            profile.Mappings.Add(new Mapping
            {
                Type         = "dynamic",
                IfReadOnly   = false,
                NameContains = string.Empty,
                Output       = "<Dynamic Name=\"$name$\" />",
            });

            var code = @"
Namespace tests
    Class Class1
        ☆Public Property SomeProperty As dynamic☆
    End Class
End Namespace";

            var expected = new ParserOutput
            {
                Name       = "SomeProperty",
                Output     = "<Dynamic Name=\"SomeProperty\" />",
                OutputType = ParserOutputType.Selection,
            };

            this.SelectionBetweenStarsShouldProduceExpected(code, expected, profile);
        }
Beispiel #12
0
        public void GetSelectionWithDynamicListProperty()
        {
            var profile = TestProfile.CreateEmpty();

            profile.SubPropertyOutput = "<DymnProp Value=\"$name$\" />";
            profile.Mappings.Add(new Mapping
            {
                Type         = "List<dynamic>",
                IfReadOnly   = false,
                NameContains = string.Empty,
                Output       = "<Dyno>$subprops$</Dyno>",
            });

            var code = @"
Namespace tests
    Class Class1
        ☆Public Property SomeList As List(Of dynamic)☆
    End Class
End Namespace";

            var expectedXaml = "<Dyno>"
                               + Environment.NewLine + "    <DymnProp Value=\"\" />"
                               + Environment.NewLine + "</Dyno>";

            // A single "DymnProp" with no value indicates that no sub-properties of the dynamic type were found
            var expected = new ParserOutput
            {
                Name       = "SomeList",
                Output     = expectedXaml,
                OutputType = ParserOutputType.Selection,
            };

            this.SelectionBetweenStarsShouldProduceExpected(code, expected, profile);
        }
        public void GetDynamicProperty()
        {
            var profile = TestProfile.CreateEmpty();

            profile.Mappings.Add(new Mapping
            {
                Type         = "dynamic",
                IfReadOnly   = false,
                NameContains = string.Empty,
                Output       = "<Dynamic Name=\"$name$\" />",
            });

            var code = @"
namespace tests
{
    class Class1
    {
        ☆public dynamic SomeProperty { get; set; }☆
    }
}";

            var expected = new ParserOutput
            {
                Name       = "SomeProperty",
                Output     = "<Dynamic Name=\"SomeProperty\" />",
                OutputType = ParserOutputType.Property,
            };

            this.EachPositionBetweenStarsShouldProduceExpected(code, expected, profile);
        }
Beispiel #14
0
        public void GetSelectionDoesNotIncludeExcludedProperties()
        {
            var code = @"
namespace tests
{
    class Class1
    {
        private static string _property8;    ☆

        public string Property1 { get; set; }
        public string IsInDesignMode { get; private set; }
        public static string IsInDesignModeStatic { get => _property8; set => _property8 = value; }
    }☆
}";

            var expectedOutput = "<TextBox Text=\"{x:Bind Property1, Mode=TwoWay}\" />";

            var expected = new ParserOutput
            {
                Name       = "Property1",
                Output     = expectedOutput,
                OutputType = ParserOutputType.Selection,
            };

            this.SelectionBetweenStarsShouldProduceExpected(code, expected);
        }
        public void GetStructProperty()
        {
            var profile = TestProfile.CreateEmpty();

            profile.Mappings.Add(new Mapping
            {
                Type         = "MyStruct",
                IfReadOnly   = false,
                NameContains = string.Empty,
                Output       = "<MyStruct />",
            });

            var code = @"
Namespace tests
    Class Class1
        ☆Public Property Property2 As MyStruct☆
    End Class

    Structure MyStruct
        Public Property MyProperty1 As String
        Public Property MyProperty2 As Integer
    End Structure
End Namespace";

            var expected = new ParserOutput
            {
                Name       = "Property2",
                Output     = "<MyStruct />",
                OutputType = ParserOutputType.Property,
            };

            this.EachPositionBetweenStarsShouldProduceExpected(code, expected, profile);
        }
Beispiel #16
0
        public async Task GetCustomProperty_InOtherFile()
        {
            var code = @"
Namespace tests
    Class Class1
        Pu☆blic Property LastOrder As Order
    End Class
End Namespace";

            var code2 = @"
Namespace tests
    Public Class Order
        Public Property OrderId As Int
        Public Property OrderDescription As String
    End Class
End Namespace";

            var expected = new ParserOutput
            {
                Name   = "LastOrder",
                Output = "<Slider Minimum=\"0\" Maximum=\"100\" x:Name=\"LastOrder.OrderId\" Value=\"{x:Bind LastOrder.OrderId, Mode=TwoWay}\" />"
                         + Environment.NewLine + "<TextBox Text=\"{x:Bind LastOrder.OrderDescription, Mode=TwoWay}\" />",
                OutputType = ParserOutputType.Property,
            };

            await this.PositionAtStarShouldProduceExpectedUsingAdditionalFiles(code, expected, additionalCode : code2);
        }
Beispiel #17
0
        public void GetStructAllPropertyOptions()
        {
            var code = @"
namespace tests
{
    struct Str☆uctViewModel
    {
        public string Property1 { get; set; }
        public string Property2 { get; private set; }
    }
}";

            var expectedOutput = "<StackPanel>"
                                 + Environment.NewLine + "    <TextBox Text=\"{x:Bind Property1, Mode=TwoWay}\" />"
                                 + Environment.NewLine + "    <TextBlock Text=\"Property2\" />"
                                 + Environment.NewLine + "</StackPanel>";

            var expected = new ParserOutput
            {
                Name       = "StructViewModel",
                Output     = expectedOutput,
                OutputType = ParserOutputType.Class,
            };

            this.PositionAtStarShouldProduceExpected(code, expected);
        }
        public void GetNullablePropertiesInSelection()
        {
            var code = @"
Namespace tests
    Class Class1
        ☆Public Property MyBool As Boolean
        Public Property MyBoolQ As Boolean? 
        Public Property MyNullableBool As Nullable(Of Boolean)
        Public Property MyFqNullableBool As System.Nullable(Of Boolean)☆
    End Class
End Namespace";

            var expectedXaml = "<Bool />"
                               + Environment.NewLine + "<BoolQ />"
                               + Environment.NewLine + "<NullBool />"
                               + Environment.NewLine + "<NullBool />";

            var expected = new ParserOutput
            {
                Name       = "MyBool, MyBoolQ and 2 other properties",
                Output     = expectedXaml,
                OutputType = ParserOutputType.Selection,
            };

            this.SelectionBetweenStarsShouldProduceExpected(code, expected, this.NullableTestsProfile);
        }
        public void GetNullablePropertiesInSelection()
        {
            var code = @"
using System.Collections.Generic;

namespace tests
{
    class Class1
    {
       ☆ public bool MyBool { get; set; }
        public bool? MyBoolQ { get; set; }
        public Nullable<bool> MyNullableBool { get; set; }
        public System.Nullable<bool> MyFqNullableBool { get; set; }☆
    }
}";

            var expectedXaml = "<Bool />"
                               + Environment.NewLine + "<BoolQ />"
                               + Environment.NewLine + "<NullBool />"
                               + Environment.NewLine + "<NullBool />";

            var expected = new ParserOutput
            {
                Name       = "MyBool, MyBoolQ and 2 other properties",
                Output     = expectedXaml,
                OutputType = ParserOutputType.Selection,
            };

            this.SelectionBetweenStarsShouldProduceExpected(code, expected, this.NullableTestsProfile);
        }
        public void GetNullablePropertiesInClass()
        {
            var code = @"
using System.Collections.Generic;

namespace tests
{
    class Cla☆ss1
    {
        public bool MyBool { get; set; }
        public bool? MyBoolQ { get; set; }
        public Nullable<bool> MyNullableBool { get; set; }
        public System.Nullable<bool> MyFqNullableBool { get; set; }
    }
}";

            var expectedXaml = "<Bool />"
                               + Environment.NewLine + "<BoolQ />"
                               + Environment.NewLine + "<NullBool />"
                               + Environment.NewLine + "<NullBool />";

            var expected = new ParserOutput
            {
                Name       = "Class1",
                Output     = expectedXaml,
                OutputType = ParserOutputType.Class,
            };

            this.PositionAtStarShouldProduceExpected(code, expected, this.NullableTestsProfile);
        }
        public void GetListOfNullableProperty()
        {
            var code = @"
using System.Collections.Generic;

namespace tests
{
    class Class1
    {
        public List<bool?> MyListOfNu☆llables { get; set; }
    }
}";

            var profile = this.NullableTestsProfile;

            profile.Mappings.Add(new Mapping
            {
                Type         = "List<bool?>",
                NameContains = string.Empty,
                IfReadOnly   = false,
                Output       = "<LBnull />",
            });

            var expected = new ParserOutput
            {
                Name       = "MyListOfNullables",
                Output     = "<LBnull />",
                OutputType = ParserOutputType.Property,
            };

            this.PositionAtStarShouldProduceExpected(code, expected, profile);
        }
Beispiel #22
0
        public void MaxLengthAttribute_SingleNumericParam_PropertyBlock()
        {
            var code = @"
Namespace tests
    Class Class

        Private _name As String

        <MaxLengthAttribute(50)>
        Public Property Name☆ As String
            Get
                Return _name
            End Get

            Set(ByVal value As String)
                _name = value
            End Set
        End Property

    End Class
End Namespace";

            var expectedOutput = "<TextBlock Text=\"Name\" MaxLength=\"50\" />";

            var expected = new ParserOutput
            {
                Name       = "Name",
                Output     = expectedOutput,
                OutputType = ParserOutputType.Member,
            };

            this.PositionAtStarShouldProduceExpected(code, expected, this.maxLengthProfile);
        }
Beispiel #23
0
        // This is based on GetCSharpClassTests.GetClassWithAllTheProperties
        private void GetNameAndType(string property, string xaml)
        {
            var code = @"
namespace tests
{
    public class TestClass
    {
        ☆" + property + @"
    }
}";

            var profile = TestProfile.CreateEmpty();

            profile.ClassGrouping  = "StackPanel";
            profile.FallbackOutput = "<TextBlock Name=\"$name$\" Type=\"$type$\" />";

            var expected = new ParserOutput
            {
                Name       = "IgNoRe",
                Output     = xaml,
                OutputType = ParserOutputType.Member,
            };

            this.PositionAtStarShouldProduceExpected(code, expected, profile);
        }
        protected void EachPositionBetweenStarsShouldProduceExpected(string code, ParserOutput expected, bool isCSharp, Profile profileOverload)
        {
            this.EnsureTwoStars(code);

            var(startPos, endPos, actualCode) = this.GetCodeAndCursorRange(code);

            var syntaxTree = isCSharp ? CSharpSyntaxTree.ParseText(actualCode)
                                      : VisualBasicSyntaxTree.ParseText(actualCode);

            Assert.IsNotNull(syntaxTree);

            var semModel = isCSharp ? CSharpCompilation.Create(string.Empty).AddSyntaxTrees(syntaxTree).GetSemanticModel(syntaxTree, ignoreAccessibility: true)
                                    : VisualBasicCompilation.Create(string.Empty).AddSyntaxTrees(syntaxTree).GetSemanticModel(syntaxTree, ignoreAccessibility: true);

            var positionsTested = 0;

            for (var pos = startPos; pos < endPos; pos++)
            {
                var indent = new TestVisualStudioAbstraction().XamlIndent;
                var parser = isCSharp ? new CSharpParser(DefaultTestLogger.Create(), indent, profileOverload) as IDocumentParser
                                      : new VisualBasicParser(DefaultTestLogger.Create(), indent, profileOverload);

                var actual = parser.GetSingleItemOutput(syntaxTree.GetRoot(), semModel, pos);

                Assert.AreEqual(expected.OutputType, actual.OutputType, $"Failure at {pos} ({startPos}-{endPos})");
                Assert.AreEqual(expected.Name, actual.Name, $"Failure at {pos} ({startPos}-{endPos})");
                StringAssert.AreEqual(expected.Output, actual.Output, $"Failure at {pos} ({startPos}-{endPos})");

                positionsTested += 1;
            }

            this.TestContext.WriteLine($"{positionsTested} different positions tested.");
        }
        public void GetAsNewProperty()
        {
            var profile = TestProfile.CreateEmpty();

            profile.Mappings.Add(new Mapping
            {
                Type         = "ShellViewModel",
                IfReadOnly   = false,
                NameContains = string.Empty,
                Output       = "<Element Name=\"$name$\" />",
            });

            var code = @"
Namespace tests
    Class Class1
        ☆Public ReadOnly Property ViewModel As New ShellViewModel
    End Class
End Namespace";

            var expected = new ParserOutput
            {
                Name       = "ViewModel",
                Output     = "<Element Name=\"ViewModel\" />",
                OutputType = ParserOutputType.Member,
            };

            this.PositionAtStarShouldProduceExpected(code, expected, profile);
        }
        public void GetListOfNullableProperty()
        {
            var code = @"
Namespace tests
    Class Class1
        Public Property MyListOf☆Nullables As List(Of Boolean?)
    End Class
End Namespace";

            var profile = this.NullableTestsProfile;

            profile.Mappings.Add(new Mapping
            {
                Type         = "List(Of Boolean?)",
                NameContains = string.Empty,
                IfReadOnly   = false,
                Output       = "<LBnull />",
            });

            var expected = new ParserOutput
            {
                Name       = "MyListOfNullables",
                Output     = "<LBnull />",
                OutputType = ParserOutputType.Property,
            };

            this.PositionAtStarShouldProduceExpected(code, expected, profile);
        }
Beispiel #27
0
        public void GetGenericListPropertyWithBackingField()
        {
            var code = @"
Imports System.Collections.Generic

Namespace tests
    Class Class1
        Private _myListProperty2 As List(Of String)

        ☆Public Property MyListProperty2 As List(Of String)
            Get
                Return _myListProperty2
            End Get

            Set(ByVal value As List(Of String))
                _myListProperty2 = value
            End Set
        End Property☆
    End Class
End Namespace";

            var expected = new ParserOutput
            {
                Name   = "MyListProperty2",
                Output = "<ItemsControl ItemsSource=\"{x:Bind MyListProperty2}\">" + Environment.NewLine +
                         "</ItemsControl>",
                OutputType = ParserOutputType.Property,
            };

            this.EachPositionBetweenStarsShouldProduceExpected(code, expected);
        }
        public void GetNullablePropertiesInClass()
        {
            var code = @"
Namespace tests
    Class Cla☆ss1
        Public Property MyBool As Boolean
        Public Property MyBoolQ As Boolean? 
        Public Property MyNullableBool As Nullable(Of Boolean)
        Public Property MyFqNullableBool As System.Nullable(Of Boolean)
    End Class
End Namespace";

            var expectedXaml = "<Bool />"
                               + Environment.NewLine + "<BoolQ />"
                               + Environment.NewLine + "<NullBool />"
                               + Environment.NewLine + "<NullBool />";

            var expected = new ParserOutput
            {
                Name       = "Class1",
                Output     = expectedXaml,
                OutputType = ParserOutputType.Class,
            };

            this.PositionAtStarShouldProduceExpected(code, expected, this.NullableTestsProfile);
        }
        public void GetPropertyWithBackingFieldAndNoSetter()
        {
            var code = @"
namespace tests
{
    class Class1
    {
        private string _property2 = ""something"";

        public string Property1 { get; set; }

        ☆public string Property2 { get => _property2; }
☆
        public string Property3 { get; set; }
    }
}";

            var expected = new ParserOutput
            {
                Name       = "Property2",
                Output     = "<TextBlock Text=\"Property2\" />",
                OutputType = ParserOutputType.Property,
            };

            this.EachPositionBetweenStarsShouldProduceExpected(code, expected);
        }
        public void EnumMappingOverridesNameOrTypeMapping()
        {
            var enumProfile = new Profile
            {
                Name              = "EnumTestProfile",
                ClassGrouping     = "Grid",
                FallbackOutput    = "<TextBlock Text=\"FB_$name$\" />",
                SubPropertyOutput = "<TextBlock Text=\"SP_$name$\" />",
                EnumMemberOutput  = "<x:String>$element$</x:String>",
                Mappings          = new ObservableCollection <Mapping>
                {
                    new Mapping
                    {
                        Type         = "Status",
                        NameContains = "OrderStatus",
                        Output       = "<OrderStatus />",
                        IfReadOnly   = false,
                    },
                    new Mapping
                    {
                        Type         = "enum",
                        NameContains = string.Empty,
                        Output       = "<ComboBox>$members$</ComboBox>",
                        IfReadOnly   = false,
                    },
                },
            };

            var code = @"
namespace tests
{
    class Class1
    {
        ☆public Status OrderStatus { get; set; }☆
    }

    enum Status
    {
        Active,
        OnHold,
        Closed,
    }
}";

            var expectedOutput = "<ComboBox>"
                                 + Environment.NewLine + "    <x:String>Active</x:String>"
                                 + Environment.NewLine + "    <x:String>OnHold</x:String>"
                                 + Environment.NewLine + "    <x:String>Closed</x:String>"
                                 + Environment.NewLine + "</ComboBox>";

            var expected = new ParserOutput
            {
                Name       = "OrderStatus",
                Output     = expectedOutput,
                OutputType = ParserOutputType.Property,
            };

            this.EachPositionBetweenStarsShouldProduceExpected(code, expected, enumProfile);
        }
 public void EmptyMemberName()
 {
     ParserOutput output = new ParserOutput();
     output.StartObject();
     output.ObjectPut(string.Empty, string.Empty);
     JsonObject o = (JsonObject) output.EndObject();
     Assert.AreEqual(1, o.Count);
     Assert.AreEqual(string.Empty, o[string.Empty]);
 }
Beispiel #32
0
        public void It_Has_The_Same_Hashcode_Each_Time()
        {
            var parserOutput = new ParserOutput { TokenType = "name", Value = "hi", Start = 0, End = 6 };
            var hashcode = parserOutput.GetHashCode();

            Assert.Equal(hashcode, parserOutput.GetHashCode());
        }
Beispiel #33
0
        public void Equality_Can_Be_Determined_By_Values_Even_With_Null_Children()
        {
            var parserOutputA = new ParserOutput { TokenType = "name", Value = "hi", Start = 0, End = 6, ChildTokens = null };
            var parserOutputB = new ParserOutput { TokenType = "name", Value = "hi", Start = 0, End = 6, ChildTokens = null };

            Assert.Equal(parserOutputA, parserOutputB);
        }
Beispiel #34
0
 public void It_Is_False_When_Compared_Against_Anything_But_ParserOutput()
 {
     var parserOutput = new ParserOutput { TokenType = "name", Value = "hi", Start = 0, End = 6, ChildTokens = null };
     Assert.False(parserOutput.Equals("Test"));
 }
Beispiel #35
0
        public void Equality_Can_Be_Determined_By_Values()
        {
            var parserOutputA = new ParserOutput { TokenType = "name", Value = "hi", Start = 0, End = 6 };
            var parserOutputB = new ParserOutput { TokenType = "name", Value = "hi", Start = 0, End = 6 };

            Assert.Equal(parserOutputA, parserOutputB);
        }
Beispiel #36
0
 public void Equality_Is_Determined_Across_All_Values(ParserOutput a, ParserOutput b)
 {
     Assert.NotEqual(a, b);
 }