public void EnsureGraphType_ScalarTwice_EndsUpInScalarCollectionOnce() { var collection = new SchemaTypeCollection(); var scalar = this.MakeGraphType(typeof(int), TypeKind.SCALAR) as IScalarGraphType; collection.EnsureGraphType(scalar); collection.EnsureGraphType(scalar); Assert.AreEqual(1, collection.Count); Assert.IsTrue(collection.Contains(GraphQLProviders.ScalarProvider.RetrieveScalar(typeof(int)))); Assert.IsTrue(collection.Contains(GraphQLProviders.ScalarProvider.RetrieveScalar(Constants.ScalarNames.INT))); Assert.IsTrue(collection.Contains(typeof(int))); }
public void EnsureGraphType_Enum_IsAddedCorrectly() { var collection = new SchemaTypeCollection(); var graphType = this.MakeGraphType(typeof(RandomEnum), TypeKind.ENUM) as IEnumGraphType; collection.EnsureGraphType(graphType, typeof(RandomEnum)); Assert.AreEqual(1, collection.Count); Assert.IsTrue(collection.Contains(typeof(RandomEnum))); }
public void EnsureGraphType_Scalar_IsAddedCorrectly() { var collection = new SchemaTypeCollection(); var scalar = this.MakeGraphType(typeof(int), TypeKind.SCALAR) as IScalarGraphType; collection.EnsureGraphType(scalar, typeof(int)); Assert.AreEqual(1, collection.Count); Assert.IsTrue(collection.Contains(typeof(int))); }