public void InvalidDirective_MethodWithNoLocations_ThrowsException() { var template = new GraphDirectiveTemplate(typeof(NoLocationsDirective)); template.Parse(); Assert.Throws <GraphTypeDeclarationException>(() => { template.ValidateOrThrow(); }); }
public void InvalidDirective_MismatchedSignatures_ThrowsException() { var template = new GraphDirectiveTemplate(typeof(MismatchedSignaturesDirective)); template.Parse(); Assert.Throws <GraphTypeDeclarationException>(() => { template.ValidateOrThrow(); }); }
public void Simpletemplate_AllDefaults_GeneralPropertyCheck() { var template = new GraphDirectiveTemplate(typeof(SimpleDirective)); template.Parse(); template.ValidateOrThrow(); Assert.AreEqual("Simple", template.Name); Assert.AreEqual(nameof(SimpleDirective), template.InternalName); Assert.AreEqual(typeof(SimpleDirective).FriendlyName(true), template.InternalFullName); Assert.AreEqual("Simple Description", template.Description); Assert.AreEqual(1, template.Methods.Count); Assert.IsTrue(template.Locations.HasFlag(DirectiveLocation.FIELD)); Assert.AreEqual(typeof(SimpleDirective), template.ObjectType); Assert.AreEqual("[directive]/Simple", template.Route.Path); Assert.AreEqual(DirectiveLocation.FIELD, template.Locations); Assert.IsNotNull(template.Methods.FindMethod(DirectiveLifeCycle.BeforeResolution)); }