Example #1
0
        public void ConvertingToGenericReturnsSameInstance()
        {
            var d  = JsDictionary.GetDictionary(new { a = "valueA", b = 134 });
            var d2 = (JsDictionary <string, object>)d;

            Assert.AreStrictEqual(d2, d);
        }
Example #2
0
        public void ClearWorks()
        {
            var d = JsDictionary <string, object> .GetDictionary(new { a = "valueA", b = 134 });

            d.Clear();
            Assert.AreEqual(d.Count, 0);
        }
Example #3
0
        public void IndexingWorks()
        {
            var d = JsDictionary <string, object> .GetDictionary(new { a = "valueA", b = 134 });

            Assert.AreEqual(d["a"], "valueA");
            Assert.AreEqual(d["b"], 134);
        }
Example #4
0
        public void ContainsKeyWorks()
        {
            var d = JsDictionary <string, object> .GetDictionary(new { a = "valueA", b = 134 });

            Assert.IsTrue(d.ContainsKey("a"));
            Assert.IsFalse(d.ContainsKey("c"));
        }
Example #5
0
        public void RemoveWorks()
        {
            var d = JsDictionary <string, object> .GetDictionary(new { a = "valueA", b = 134 });

            d.Remove("a");
            Assert.AreEqual(d.Keys, new[] { "b" });
        }
Example #6
0
        public void KeysWorks()
        {
            var d    = JsDictionary.GetDictionary(new { a = "valueA", b = 134 });
            var keys = d.Keys;

            Assert.IsTrue(keys.Contains("a"));
            Assert.IsTrue(keys.Contains("b"));
        }
Example #7
0
        public void GetDictionaryWorks()
        {
            var obj = new { a = "valueA", b = 134 };
            var d   = JsDictionary <string, object> .GetDictionary(obj);

            Assert.AreStrictEqual(d, obj);
            Assert.AreEqual(2, d.Keys.Count);
            Assert.AreEqual(d["a"], "valueA");
            Assert.AreEqual(d["b"], 134);
        }
Example #8
0
 public virtual void DependenciesAvailable()
 {
     if (config != null)
     {
         InitConfig(JsDictionary.GetDictionary(config));
     }
     else
     {
         InitDefault();
     }
 }
 public TabControl(object config)
 {
     if (!Script.IsUndefined(config))
     {
         InitConfig(JsDictionary.GetDictionary(config));
     }
     else
     {
         InitDefault();
     }
 }
Example #10
0
        public void JsDictionaryConstructorWorks()
        {
            var orig = JsDictionary <string, int> .GetDictionary(new { a = 1, b = 2 });

            var d = new Dictionary <string, int>(orig);

            Assert.IsFalse((object)d == (object)orig);
            Assert.AreEqual(d.Count, 2);
            Assert.AreEqual(d["a"], 1);
            Assert.AreEqual(d["b"], 2);
        }
Example #11
0
        public void GetEnumeratorWorks()
        {
            var d  = JsDictionary.GetDictionary(new { a = "valueA", b = 134 });
            var d2 = new JsDictionary();

            foreach (var kvp in d)
            {
                d2[kvp.Key] = kvp.Value;
            }
            Assert.AreEqual(d, d2);
        }
Example #12
0
 public Grid(object config)
 {
     dragFeedbackHandler = new jQueryEventHandler(ValuesDiv_DragFeedback);
     if (!Script.IsUndefined(config))
     {
         InitConfig(JsDictionary.GetDictionary(config));
     }
     else
     {
         InitDefault();
     }
 }
Example #13
0
        public void JsDictionaryAndEqualityComparerConstructorWorks()
        {
            var c    = new TestEqualityComparer();
            var orig = JsDictionary <string, int> .GetDictionary(new { a = 1, b = 2 });

            var d = new Dictionary <string, int>(orig, c);

            Assert.IsFalse((object)d == (object)orig);
            Assert.AreEqual(d.Count, 2);
            Assert.AreEqual(d["a"], 1);
            Assert.AreEqual(d["b"], 2);
            Assert.AreStrictEqual(d.Comparer, c);
        }
Example #14
0
        public void CopyConstructorWorks()
        {
            var orig = JsDictionary <string, int> .GetDictionary(new { a = 1, b = 2 });

            var d  = new Dictionary <string, int>(orig);
            var d2 = new Dictionary <string, int>(d);

            Assert.IsFalse((object)d == (object)d2);
            Assert.AreEqual(d2.Count, 2);
            Assert.AreEqual(d2["a"], 1);
            Assert.AreEqual(d2["b"], 2);
            Assert.AreStrictEqual(d2.Comparer, EqualityComparer <string> .Default);
        }
Example #15
0
 /// <summary>
 /// On the server, an easier way to obtain a parser is through the SaltarelleParserFactory class.
 /// </summary>
 public SaltarelleParser(INodeProcessor[] pluginNodeProcessors, IDictionary <string, ITypedMarkupParserImpl> pluginTypedMarkupParsers, IUntypedMarkupParserImpl[] pluginUntypedMarkupParsers)
 {
                 #if CLIENT
     JsDictionary cfg = JsDictionary.GetDictionary(pluginNodeProcessors);
     if (!Script.IsNullOrUndefined(cfg) && cfg.ContainsKey("pluginNodeProcessors"))
     {
         // We have an [AlternateSignature] constructor which can cause us to be called with a config object instead of real parameters
         configObject = cfg;
         return;
     }
                 #endif
     docProcessor = new DocumentProcessor(pluginNodeProcessors, new TypedMarkupParser(pluginTypedMarkupParsers), new UntypedMarkupParser(pluginUntypedMarkupParsers));
     this.pluginNodeProcessors       = pluginNodeProcessors ?? new INodeProcessor[0];
     this.pluginTypedMarkupParsers   = pluginTypedMarkupParsers ?? new Dictionary <string, ITypedMarkupParserImpl>();
     this.pluginUntypedMarkupParsers = pluginUntypedMarkupParsers ?? new IUntypedMarkupParserImpl[0];
 }
Example #16
0
 protected DialogBase(object config)
 {
     this.config = (!Script.IsUndefined(config) ? JsDictionary.GetDictionary(config) : null);
 }
Example #17
0
        public DefaultSaltarelleUIService(object config)
        {
            var cfg = JsDictionary.GetDictionary(config);

            this.blankImageUrl = (string)cfg["blankImageUrl"];
        }
 public ControlListControl(object config)
 {
     this.config = !Script.IsUndefined(config) ? JsDictionary.GetDictionary(config) : null;
 }