public void AddSingleSubscriptionAction_AllDefaults_EnsureFieldStructure() { using var restorePoint = new GraphQLProviderRestorePoint(); GraphQLProviders.TemplateProvider = new SubscriptionEnabledTemplateProvider(); var schema = new GraphSchema() as ISchema; schema.SetNoAlterationConfiguration(); schema.SetSubscriptionAllowances(); var manager = new GraphSchemaManager(schema); manager.EnsureGraphType <SimpleMethodController>(); // query always exists // subscription root was found via the method parsed // mutation was not provided Assert.IsTrue(schema.OperationTypes.ContainsKey(GraphCollection.Query)); Assert.IsFalse(schema.OperationTypes.ContainsKey(GraphCollection.Mutation)); Assert.IsTrue(schema.OperationTypes.ContainsKey(GraphCollection.Subscription)); // field for the controller exists var topFieldName = nameof(SimpleMethodController).Replace(Constants.CommonSuffix.CONTROLLER_SUFFIX, string.Empty); Assert.IsTrue(schema.OperationTypes[GraphCollection.Subscription].Fields.ContainsKey(topFieldName)); // ensure the field on the subscription operation is the right name (i.e. the controller name) var topField = schema.OperationTypes[GraphCollection.Subscription][topFieldName]; Assert.IsNotNull(topField); var type = schema.KnownTypes.FindGraphType(topField) as IObjectGraphType; var action = TemplateHelper.CreateFieldTemplate <SimpleMethodController>(nameof(SimpleMethodController.TestActionMethod)); // ensure the action was put into the field collection of the controller operation Assert.IsTrue(type.Fields.ContainsKey(action.Route.Name)); }