public void ClipboardModule_ArgumentChecks()
        {
            var module = new ClipboardModule();

            AssertEx.Throws <ArgumentNullException>(
                () => module.getString(null),
                ex => Assert.AreEqual("promise", ex.ParamName));
        }
        public void ClipboardModule_SetString_Null_Method()
        {
            var module     = new ClipboardModule();
            var result     = "";
            var waitHandle = new AutoResetEvent(false);

            var promise = new MockPromise(resolve => { result = resolve.ToString(); waitHandle.Set(); },
                                          reject => { result = reject; waitHandle.Set(); });

            module.setString(null);
            module.getString(promise);

            waitHandle.WaitOne();
            Assert.AreEqual("", result);
        }
예제 #3
0
        public void ClipboardModule_SetString_Null_Method()
        {
            var clipboard = new MockClipboardInstance();
            var module    = new ClipboardModule(clipboard);

            var result     = "";
            var waitHandle = new AutoResetEvent(false);

            var promise = new MockPromise(resolve => { result = resolve.ToString(); waitHandle.Set(); },
                                          (code, message, stack, userInfo) => { result = message; waitHandle.Set(); });

            module.setString(null);
            module.getString(promise);

            waitHandle.WaitOne();
            Assert.AreEqual("", result);
        }
        public void ClipboardModule_GetString_Method()
        {
            var module = new ClipboardModule();

            var result     = "";
            var str        = "test string";
            var waitHandle = new AutoResetEvent(false);

            var promise = new MockPromise(resolve => { result = resolve.ToString(); waitHandle.Set(); },
                                          (code, message, e) => { result = message; waitHandle.Set(); });

            module.setString(str);
            module.getString(promise);

            waitHandle.WaitOne();
            Assert.AreEqual(str, result);
        }