示例#1
0
        public void AddDocumentFromFile_Builder_Is_Null()
        {
            // arrange
            // act
            Action action = () =>
                            SchemaBuilderExtensions.AddDocumentFromFile(null, "abc");

            // assert
            Assert.Throws <ArgumentNullException>(action);
        }
示例#2
0
        public void AddDocumentFromFile_File_Is_Null()
        {
            // arrange
            var builder = SchemaBuilder.New();

            // act
            Action action = () =>
                            SchemaBuilderExtensions.AddDocumentFromFile(builder, null);

            // assert
            Assert.Throws <ArgumentException>(action);
        }
示例#3
0
        public async Task AddDocumentFromFile()
        {
            // arrange
            var    builder = SchemaBuilder.New();
            string file    = IOPath.GetTempFileName();
            await File.WriteAllTextAsync(file, "type Query { a: String }");

            // act
            SchemaBuilderExtensions.AddDocumentFromFile(builder, file);

            // assert
            ISchema schema = builder
                             .Use(next => context => next.Invoke(context))
                             .Create();

            schema.ToString().MatchSnapshot();
        }