Exemple #1
0
        public void EditorsTest()
        {
            var mock = new MainWindowMock();
            var context = new CSharp.Context();
            WindowObject.AttachToContext(context, mock);

            bool result = (bool)context.Execute("!!window.editors");
            Assert.IsTrue(result);
        }
Exemple #2
0
        public void ExitTest()
        {
            var mock = new MainWindowMock();
            var context = new CSharp.Context();
            WindowObject.AttachToContext(context, mock);

            context.Execute("window.exit()");

            Assert.AreEqual(mock.ExitCalled, 1);
        }
Exemple #3
0
        public void AddCommandTest()
        {
            var mock = new MainWindowMock();
            var context = new CSharp.Context();
            WindowObject.AttachToContext(context, mock);
            CommandObject.Attach(context);

            context.Execute("window.addCommand(new Command())");

            Assert.AreEqual(mock.Commands.Count, 1);
        }
Exemple #4
0
        public void GetTitleTest()
        {
            var mock = new MainWindowMock();
            var context = new CSharp.Context();
            WindowObject.AttachToContext(context, mock);

            string title = "Test";
            mock.Title = title;
            string result = context.Execute("window.getTitle()").ToString();

            Assert.AreEqual(result, title);
        }
Exemple #5
0
        public void RemoveApplicationCommandTest()
        {
            var mock = new MainWindowMock();
            var context = new CSharp.Context();
            WindowObject.AttachToContext(context, mock);
            CommandObject.Attach(context);

            context.Execute(@"
                var c = new Command();
                window.addApplicationCommand(c);
                window.removeApplicationCommand(c);");

            Assert.AreEqual(mock.ApplicationCommands.Count, 0);
        }
Exemple #6
0
        public void SetTitleTest()
        {
            var mock = new MainWindowMock();
            var context = new CSharp.Context();
            WindowObject.AttachToContext(context, mock);

            context.Execute("window.setTitle(\"Test\")");

            Assert.AreEqual(mock.Title, "Test");
        }