/// <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(); }
public void AddSingleItemTwice_IsSetOnce() { var memory1 = "abc123".AsMemory(); var hashSet = new CharMemoryHashSet(); hashSet.Add(memory1); hashSet.Add(memory1); Assert.AreEqual(1, hashSet.Count); }
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); }
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); }
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); }