Ejemplo n.º 1
0
        public async void ShouldNotAllowSwappingOfBaseScalarType(
            string name, Type type, string desc)
        {
            // arrange, register custom base scalar type
            var customBaseScalarType = new CustomScalarType(name, type, desc);
            var schema = Schema.Create(c =>
            {
                c.RegisterType(customBaseScalarType);
            });

            // act, use introspection to retrieve registered type description
            IExecutionResult result =
                await schema.MakeExecutable().ExecuteAsync(
                    @"{
                        __type(type: """ + name + @""")
                        {
                            name
                            kind
                            description
                        }
                    }");

            //assert
            result.MatchSnapshot("ShouldNotAllowSwappingOfBaseScalarType" + name);
        }
Ejemplo n.º 2
0
        public async void RegisterCustomExtendedScalarType(
            string name, Type type, string desc)
        {
            // arrange, register custom scalar type
            var customScalarType = new CustomScalarType(name, type, desc);
            var schema           = Schema.Create(c =>
            {
                c.RegisterType(customScalarType);
            });

            // act, use introspection to retrieve registered type description
            IExecutionResult result =
                await schema.MakeExecutable().ExecuteAsync(
                    @"{
                        __type(type: """ + name + @""")
                        {
                            name
                            kind
                            description
                        }
                    }");

            //assert
            result.MatchSnapshot(SnapshotNameExtension.Create(name));
        }