/// <summary>
        /// Initializes a new instance of the <see cref="FieldSelectionSet" /> class.
        /// </summary>
        /// <param name="graphType">The graph type this selection set is acting on.</param>
        /// <param name="rootPath">The document specific root path under which all fields should be nested in this selection set.</param>
        public FieldSelectionSet(IGraphType graphType, SourcePath rootPath)
        {
            this.GraphType     = Validation.ThrowIfNullOrReturn(graphType, nameof(graphType));
            _knownFieldAliases = new CharMemoryHashSet();
            _fields            = new List <FieldSelection>();

            Validation.ThrowIfNull(rootPath, nameof(rootPath));
            this.RootPath = rootPath.Clone();
        }
Exemplo n.º 2
0
        public void AddSingleItemTwice_IsSetOnce()
        {
            var memory1 = "abc123".AsMemory();

            var hashSet = new CharMemoryHashSet();

            hashSet.Add(memory1);
            hashSet.Add(memory1);

            Assert.AreEqual(1, hashSet.Count);
        }
Exemplo n.º 3
0
        public void AddEquivilantButDifferentItems_IsSetOnce()
        {
            var memory1 = "abc123".AsMemory();
            var memory2 = "abc123".AsMemory();

            var hashSet = new CharMemoryHashSet();

            hashSet.Add(memory1);
            hashSet.Add(memory2);

            Assert.AreEqual(1, hashSet.Count);
        }
Exemplo n.º 4
0
        public void AddRangeOfDifferentItems_AllAreSet()
        {
            var memory1 = "abc123".AsMemory();
            var memory2 = "abc1234".AsMemory();
            var list    = new List <ReadOnlyMemory <char> >();

            list.Add(memory1);
            list.Add(memory2);

            var hashSet = new CharMemoryHashSet();

            hashSet.AddRange(list);

            Assert.AreEqual(2, hashSet.Count);
        }
Exemplo n.º 5
0
        public void AddRangeOfEquivilantItems_IsSetOnce()
        {
            var memory1 = "abc123".AsMemory();
            var memory2 = "abc123".AsMemory();
            var list    = new List <ReadOnlyMemory <char> >();

            list.Add(memory1);
            list.Add(memory2);

            var hashSet = new CharMemoryHashSet();

            hashSet.AddRange(list);

            Assert.AreEqual(1, hashSet.Count);
        }