public void CannotUseInJSEnginee() { string jsFormat = "var f = function() {var i = 30; #replace# var j = 10; return i + j;}; f();"; var engine = new ScriptEngine(); IBrowserAPI api = new MessageChannelAPI(); var result = engine.Evaluate <int>(jsFormat.Replace("#replace#", api.GetAPIJSCode())); Assert.AreNotEqual(result, 40); }
public void BrowserEnable() { IBrowserAPI api = new MessageChannelAPI(); Assert.IsFalse(api.IsThisBrowserEnableThisBrowserAPI(new IE6())); Assert.IsFalse(api.IsThisBrowserEnableThisBrowserAPI(new IE7())); Assert.IsFalse(api.IsThisBrowserEnableThisBrowserAPI(new IE8())); Assert.IsFalse(api.IsThisBrowserEnableThisBrowserAPI(new IE9())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new IE10())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new IE11())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new Chrome())); Assert.IsFalse(api.IsThisBrowserEnableThisBrowserAPI(new Firefox())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new Opera())); Assert.IsTrue(api.IsThisBrowserEnableThisBrowserAPI(new Safari())); }