示例#1
0
        public void TestIntSupport()
        {
            var schema = TestSchema.GetInstance();

            // Ask for the custom pattern
            var testPattern = (ITestPattern)_customElement.GetCurrentPattern(schema.PatternId);

            Assert.IsNotNull(testPattern);

            // Call through a pattern getter
            var testPropertyValue = testPattern.CurrentIntValue;

            Assert.AreEqual(42, testPropertyValue);

            // Call for the custom property directly
            var testPropertyValue2 = (int)_customElement.GetCurrentPropertyValue(schema.IntValueProperty.PropertyId);

            Assert.AreEqual(42, testPropertyValue2);

            // Call a pattern passer
            int testPropertyValue3;

            testPattern.PassIntParam(82, out testPropertyValue3);
            Assert.AreEqual(82, testPropertyValue3);
        }
示例#2
0
        public void TestDoubleSupport()
        {
            var schema = TestSchema.GetInstance();

            // Ask for the custom pattern
            var testPattern = (ITestPattern)_customElement.GetCurrentPattern(schema.PatternId);

            Assert.IsNotNull(testPattern);

            // Call through a pattern getter
            var testPropertyValue = testPattern.CurrentDoubleValue;

            Assert.AreEqual(3.1415, testPropertyValue);

            // We cannot request the property directly,
            // since it is declared as a method, not a property.
            //double testPropertyValue2 = (double)this.customElement.GetCurrentPropertyValue(schema.DoubleValueProperty.PropertyId);
            //Assert.AreEqual(3.1415, testPropertyValue2);

            // Call a pattern passer
            double testPropertyValue3;

            testPattern.PassDoubleParam(1.772, out testPropertyValue3);
            Assert.AreEqual(1.772, testPropertyValue3);
        }
示例#3
0
        public void Execute_CustomDirective_ResolvesCorrectly()
        {
            var     schema = new TestSchema();
            dynamic result = schema.Execute("{ foo @onField }");

            Assert.AreEqual("replacedByDirective", result.data.foo);
        }
示例#4
0
        public void TestBoolSupport()
        {
            var schema = TestSchema.GetInstance();

            // Ask for the custom pattern
            var testPattern = (ITestPattern)
                              _customElement.GetCurrentPattern(schema.PatternId);

            Assert.IsNotNull(testPattern);

            // Call through a pattern getter
            var testPropertyValue = testPattern.CurrentBoolValue;

            Assert.AreEqual(true, testPropertyValue);

            // We cannot request the property directly,
            // since it is declared as a method, not a property.
            //bool testPropertyValue2 = (bool)this.customElement.GetCurrentPropertyValue(schema.BoolValueProperty.PropertyId);
            //Assert.AreEqual(true, testPropertyValue2);

            // Call a pattern passer
            bool testPropertyValue3;

            testPattern.PassBoolParam(true, out testPropertyValue3);
            Assert.AreEqual(true, testPropertyValue3);
        }
示例#5
0
        public void TestStringSupport()
        {
            var schema = TestSchema.GetInstance();

            // Ask for the custom pattern
            var testPattern = (ITestPattern)_customElement.GetCurrentPattern(schema.PatternId);

            Assert.IsNotNull(testPattern);

            // Call through a pattern getter
            var testPropertyValue = testPattern.CurrentStringValue;

            Assert.AreEqual("TestString", testPropertyValue);

            // Call for the custom property directly
            var testPropertyValue2 = (string)_customElement.GetCurrentPropertyValue(schema.StringValueProperty.PropertyId);

            Assert.AreEqual("TestString", testPropertyValue2);

            // Call a pattern passer
            string testPropertyValue3;

            testPattern.PassStringParam("String2", out testPropertyValue3);
            Assert.AreEqual("String2", testPropertyValue3);
        }
示例#6
0
 public GraphQLController(IDocumentExecuter executer, IDocumentWriter writer, TestSchema schema, DataLoaderDocumentListener dataLoaderListener)
 {
     _executer           = executer;
     _writer             = writer;
     _schema             = schema;
     _dataLoaderListener = dataLoaderListener;
 }
示例#7
0
        public void SetUp()
        {
            this.argumentsOfCorrectType = new ArgumentsOfCorrectType();
            this.validationTestSchema   = new TestSchema();

            this.validationContext = new ValidationContext();
        }
示例#8
0
        public void ResolvesCatModelForTwoFragments()
        {
            var schema = new TestSchema();

            var result = schema.Execute(@"
            {
                animal {
                    __typename
                    ... on Cat {
                        id
                        name
                        whatDoesTheCatSay
                    }
                    ... on Dog {
                        id
                        name
                        whatDoesTheDogSay
                    }
                }
            }
            ");

            Assert.AreEqual("Cat", result.data.animal.__typename);
            Assert.AreEqual(1, result.data.animal.id);
            Assert.AreEqual("Mourek", result.data.animal.name);
            Assert.AreEqual("Meow", result.data.animal.whatDoesTheCatSay);
        }
        ////////////////////////////////////////////////////////////////////////////////////////////////
        /*--------------------------------------------------------------------------------------------*/
        protected override void SetUp()
        {
            base.SetUp();
            vSchema = new TestSchema();

            vPlc = vSchema.GetEdgeSchema(typeof(PersonLikesCandy).Name);

            vProp = new WeaverTitanPropSchema("TestProp", "TP", typeof(string));
            vProp.AddTitanVertexCentricIndex(vPlc);
        }
    void Awake()
    {
        if (_profileExist == false)         //singleton initsialization
        {
            _profileExist = true;

            _Profile = new Person();
            DontDestroyOnLoad(this.gameObject);

            menuGUI    = GetComponent <MenuGui>();
            testSchema = GetComponent <TestSchema>();
            //tell gui to modify this test scheme
        }
    }
示例#11
0
        public SubscriptionProtocolHandlerFacts()
        {
            _schema               = new TestSchema();
            _documentExecuter     = Substitute.For <IDocumentExecuter>();
            _subscriptionExecuter = Substitute.For <ISubscriptionExecuter>();
            _messageWriter        = Substitute.For <IJsonMessageWriter>();

            var logger = Substitute.For <ILogger <SubscriptionProtocolHandler <TestSchema> > >();

            _sut = new SubscriptionProtocolHandler <TestSchema>(
                _schema,
                _subscriptionExecuter,
                _documentExecuter,
                logger);
        }
示例#12
0
        public void CorrectlyIntrospectsUnionType()
        {
            /*
             * kind must return __TypeKind.UNION.
             * name must return a String.
             * description may return a String or null.
             * possibleTypes returns the list of types that can be represented within this union. They must be object types.
             * All other fields must return null.
             */
            var schema = new TestSchema();

            var result = schema.Execute(@"
            {
              __type(name: " + "\"TestUnion\"" + @") {
                name
                description
                kind
                possibleTypes {
                    name
                }
                interfaces {
                    name
                }
                fields {
                    name
                }
                inputFields {
                    name
                }
                ofType {
                    name
                }
              }
            }
            ");

            Assert.AreEqual("TestUnion", result.data.__type.name);
            Assert.AreEqual("Some union description", result.data.__type.description);
            Assert.AreEqual("UNION", result.data.__type.kind);
            Assert.AreEqual("Dog", ((IEnumerable <dynamic>)result.data.__type.possibleTypes).ElementAt(0).name);
            Assert.AreEqual("Cat", ((IEnumerable <dynamic>)result.data.__type.possibleTypes).ElementAt(1).name);
            Assert.IsNull(result.data.__type.interfaces);
            Assert.IsNull(result.data.__type.fields);
            Assert.IsNull(result.data.__type.inputFields);
            Assert.IsNull(result.data.__type.ofType);
        }
示例#13
0
        static async Task Main(string[] args)
        {
            if (args.Length < 2)
            {
                return;
            }

            string RootId       = args[0];
            string RootPassword = args[1];

            ISimpleDatabase Database = new SimpleDatabase();

            Database.Initialize(ConnectorType.MySql, ConnectionOption.KeepAlive, true);
            bool IsServerStarted = Database.IsServerStarted;

            ITestSchema TestSchema = new TestSchema(false);
            ICredential Credential = new Credential("localhost", "test", "test", TestSchema);

            bool Success;

            Success = Database.IsCredentialValid(Credential);
            Success = Database.CreateCredential(RootId, RootPassword, Credential);
            Success = Database.IsCredentialValid(Credential);
            Success = Database.CreateTables(Credential);
            Success = Database.Open(Credential);

            IDeleteResult DeleteResult;

            DeleteResult = Database.Run(new DeleteContext(TestSchema.Test0, 0));
            DeleteResult = Database.Run(new DeleteContext(TestSchema.Test1, 0));
            DeleteResult = Database.Run(new DeleteContext(TestSchema.Test2, 0));

            await Test(Database, TestSchema);

            DeleteResult = Database.Run(new DeleteContext(TestSchema.Test0, 0));
            DeleteResult = Database.Run(new DeleteContext(TestSchema.Test1, 0));
            DeleteResult = Database.Run(new DeleteContext(TestSchema.Test2, 0));

            Database.Close();
            Database.DeleteTables(Credential);
            Database.DeleteCredential(RootId, RootPassword, Credential);

            Thread.Sleep(5000);
            Success = Database.IsCredentialValid(Credential);
        }
示例#14
0
    // Use this for initialization
    void Start()
    {
        GameObject application = GameObject.Find("Scriptbinder");

        if (application != null)
        {
            //load current test name
            TestSchema appSchema   = application.GetComponent <TestSchema>();
            string     currentTest = appSchema.getCurrentTestName();
            //set name to text ui lable.
            Text outputTo = GetComponent <Text>();
            if (outputTo == null)
            {
                outputTo.text = currentTest;
            }
            outputTo.text = currentTest;
        }
    }
示例#15
0
        public void SetUp()
        {
            this.schema = new TestSchema();

            this.testDirective = Substitute.For <GraphQLDirectiveType>(
                "test", "some description", DirectiveLocation.FIELD);

            this.testDirective.PreExecutionIncludeFieldIntoResult(null, null)
            .ReturnsForAnyArgs(true);

            this.testDirective.PostExecutionIncludeFieldIntoResult(null, null, null, null)
            .ReturnsForAnyArgs(true);

            this.testDirective.GetResolver(Arg.Any <Func <Task <object> > >(), Arg.Any <object>())
            .Returns((Expression <Func <object> >)(() => "modified"));

            this.schema.AddOrReplaceDirective(this.testDirective);
        }
示例#16
0
        public SubscriptionProtocolHandlerFacts()
        {
            _schema               = new TestSchema();
            _documentExecuter     = Substitute.For <IDocumentExecuter>();
            _subscriptionExecuter = Substitute.For <ISubscriptionExecuter>();
            _messageWriter        = Substitute.For <IJsonMessageWriter>();

            _connection = Substitute.For <IConnectionContext>();
            _connection.Writer.Returns(_messageWriter);
            _connection.ConnectionId.Returns("1");

            var logger = Substitute.For <ILogger <SubscriptionProtocolHandler <TestSchema> > >();

            _sut = new SubscriptionProtocolHandler <TestSchema>(
                _schema,
                _subscriptionExecuter,
                _documentExecuter,
                logger);
        }
示例#17
0
        public void TestElementSupport()
        {
            var schema = TestSchema.GetInstance();

            // Ask for the custom pattern
            var testPattern = (ITestPattern)_customElement.GetCurrentPattern(schema.PatternId);

            Assert.IsNotNull(testPattern);

            // Call through a pattern getter
            // We expect to get the custom element
            var testPropertyValue = testPattern.CurrentElementValue;
            var compareResult     = _factory.CompareElements(_customElement, testPropertyValue);

            Assert.AreNotEqual(0, compareResult);

            // Call for the custom property directly
            // We cannot request the property directly,
            // since it is declared as a method, not a property.
            //Interop.UIAutomationClient.IUIAutomationElement testPropertyValue2 = (Interop.UIAutomationClient.IUIAutomationElement)this.customElement.GetCurrentPropertyValue(schema.ElementValueProperty.PropertyId);
        }
示例#18
0
        public void CanReturnDataFromResolver()
        {
            var schema = new TestSchema();

            var result = schema.Execute(@"
            {
                animal {
                    __typename
                    ... on Cat {
                        id
                        name
                        whatDoesTheCatSay
                    }
                }
            }
            ");

            Assert.AreEqual("Cat", result.data.animal.__typename);
            Assert.AreEqual(1, result.data.animal.id);
            Assert.AreEqual("Mourek", result.data.animal.name);
            Assert.AreEqual("Meow", result.data.animal.whatDoesTheCatSay);
        }
示例#19
0
        public void MyTestInitialize()
        {
            // Create the factory and register schemas
            _factory = new CUIAutomationClass();
            ReadyStateSchema.GetInstance().Register();
            TestSchema.GetInstance().Register();
            ColorSchema.GetInstance().Register();

            // Start the app
            var curDir = Environment.CurrentDirectory;

            _app = new TargetApp(curDir + "\\UiaControls.exe");
            _app.Start();

            // Find the main control
            var appElement = _factory.ElementFromHandle(_app.MainWindow);
            var condition  = _factory.CreatePropertyCondition(
                UIA_PropertyIds.UIA_AutomationIdPropertyId,
                "triColorControl1");

            _customElement = appElement.FindFirst(TreeScope.TreeScope_Children,
                                                  condition);
            Assert.IsNotNull(_customElement);
        }
示例#20
0
    void Awake()
    {
        if (!_isActive)
        {
            DontDestroyOnLoad(this.gameObject);
            _isActive = true;

            //init
            Steering = SteeringControls.instance();
            //Trackcapture  = sceneTrackdata.instance();
            //SceneChanger  = GetComponent<changeScene>();
            //unsign monobehaviors for more easy to bind gui events
            userProfile  = GetComponent <ProfileManager>();
            testSchema   = GetComponent <TestSchema>();
            menuUI       = GetComponent <MenuGui>();
            screensize   = new Rect();
            screensize.x = Screen.width;
            screensize.y = Screen.height;
        }
        else
        {
            Destroy(this.gameObject);
        }
    }
示例#21
0
        public void ResolvesUnknownTypeToNull()
        {
            var schema = new TestSchema();

            var result = schema.Execute(@"
            {
                unionReturningInvalidType {
                    __typename
                    ... on Cat {
                        id
                        name
                        whatDoesTheCatSay
                    }
                    ... on Dog {
                        id
                        name
                        whatDoesTheDogSay
                    }
                }
            }
            ");

            Assert.AreEqual(null, result.data.unionReturningInvalidType);
        }
示例#22
0
 public void SetUp()
 {
     this.schema = new TestSchema();
 }
示例#23
0
 protected virtual void SetUp()
 {
     Schema   = new TestSchema();
     WeavInst = new WeaverInstance(ConfigHelper.VertexTypes, ConfigHelper.EdgeTypes);
 }
示例#24
0
 public TestController(TestSchema schema,
                       IDocumentExecuter executer)
 {
     _schema   = schema;
     _executer = executer;
 }
示例#25
0
 public void SetUp()
 {
     this.validationTestSchema = new TestSchema();
     this.validationContext    = new ValidationContext();
 }
        public void SetUp()
        {
            var schema = new TestSchema();

            this.visitor = new VariableUsagesProviderTestVisitor(schema);
        }
示例#27
0
 public GraphQLTestController(TestSchema schema)
 {
     _schema = schema;
 }
示例#28
0
 public void Setup()
 {
     this.eventBus = new InMemoryEventBus();
     this.schema   = new TestSchema(this.eventBus);
 }