コード例 #1
0
        public void Add_adds_named_list()
        {
            // arrange
            TagDictionary target;
            TagList       actual;
            TagCollection expected;
            string        expectedName;

            expectedName = "AlphaList";
            expected     = new TagCollection(TagType.Int)
            {
                2, 4, 8, 16, 32, 64, 128, 256
            };

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, expected);

            // assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(target.Contains(expectedName));
            Assert.AreEqual(expectedName, actual.Name);
            Assert.AreEqual(expected, actual.Value);
        }
コード例 #2
0
        public void Add_adds_named_list_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;
            TagCollection expected;
            string        expectedName;

            expectedName = "BetaList";
            expected     = new TagCollection(TagType.Int)
            {
                2, 4, 8, 16, 32, 64, 128, 256
            };

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)expected);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.GetValue());
        }
コード例 #3
0
ファイル: BexisUIHelper.cs プロジェクト: payamad/Core
        protected void mergeAttributes(BexisUITagType tagType, Dictionary <string, object> htmlAttributes)
        {
            //tag exist
            if (TagDictionary.ContainsKey(tagType))
            {
                // get HtmlAttributeDic
                Dictionary <string, object> currentHtmlAttributeDic = TagDictionary[tagType];

                foreach (KeyValuePair <string, object> kvp in htmlAttributes)
                {
                    // htmlAttribute exist
                    if (currentHtmlAttributeDic.ContainsKey(kvp.Key))
                    {
                        currentHtmlAttributeDic[kvp.Key] = " " + kvp.Value;
                    }
                    // htmlAttribute not exist
                    else
                    {
                        currentHtmlAttributeDic.Add(kvp.Key, kvp.Value);
                    }
                }
            }
            //create tag dic add htmlattribute to the HtmlAttributeDic
            else
            {
                Dictionary <string, object> currentHtmlAttributeDic = new Dictionary <string, object>();
                TagDictionary.Add(tagType, htmlAttributes);
            }
        }
コード例 #4
0
ファイル: BexisUIHelper.cs プロジェクト: payamad/Core
 protected void mergeAttribute(BexisUITagType tagType, string key, object value)
 {
     //tag exist
     if (TagDictionary.ContainsKey(tagType))
     {
         // get HtmlAttributeDic
         Dictionary <string, object> currentHtmlAttributeDic = TagDictionary[tagType];
         // htmlAttribute exist
         if (currentHtmlAttributeDic.ContainsKey(key))
         {
             currentHtmlAttributeDic[key] += " " + value;
         }
         // htmlAttribute not exist
         else
         {
             currentHtmlAttributeDic.Add(key, value);
         }
     }
     //create tag dic add htmlattribute to the HtmlAttributeDic
     else
     {
         Dictionary <string, object> currentHtmlAttributeDic = new Dictionary <string, object>();
         currentHtmlAttributeDic.Add(key, value);
         TagDictionary.Add(tagType, currentHtmlAttributeDic);
     }
 }
コード例 #5
0
        public void Add_adds_named_guid_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;

            byte[] expected;
            string expectedName;
            Guid   value;

            expectedName = "BetaByteArray";
            expected     = new byte[] { 102, 249, 193, 82, 111, 73, 2, 72, 132, 29, 158, 85, 121, 200, 103, 6 };
            value        = new Guid("{52C1F966-496F-4802-841D-9E5579C86706}");

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)value);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.GetValue());
        }
コード例 #6
0
ファイル: BexisUIHelper.cs プロジェクト: payamad/Core
        public List()
        {
            _dataSource = null;

            TagDictionary.Add(BexisUITagType.a, new Dictionary <string, object>());

            TagDictionary.Add(BexisUITagType.ul, new Dictionary <string, object>());
            addAttribute(BexisUITagType.ul, "class", "bx-list");
        }
コード例 #7
0
        public void Add_throws_exception_for_unsupported_data_type()
        {
            // arrange
            var target = new TagDictionary();

            // act
            var e = Assert.Throws <ArgumentException>(() => target.Add("alpha", TimeSpan.MinValue));

            Assert.Equal($"Invalid value type.{Environment.NewLine}Parameter name: value", e.Message);
        }
コード例 #8
0
        public void Add_throws_exception_for_unsupported_data_type()
        {
            // arrange
            TagDictionary target;

            target = new TagDictionary();

            // act
            target.Add("alpha", TimeSpan.MinValue);
        }
コード例 #9
0
        public void BasicTest()
        {
            var TestObject = new TagDictionary <string, string>();

            10.Times(x => TestObject.Add("Object" + x, (x + 1).Times(y => "Key" + y).ToArray()));
            11.Times(x => Assert.Equal(10 - x, TestObject["Key" + x].Count()));
            Assert.Equal(10, TestObject["Key0"].Count());
            TestObject.Remove("Key0");
            Assert.Empty(TestObject["Key0"]);
            11.Times(x => Assert.Empty(TestObject["Key" + x]));
        }
コード例 #10
0
        public override TagDictionary ReadCompound()
        {
            var results = new TagDictionary();

            var tag = ReadTag();

            while (tag.Type != TagType.End)
            {
                results.Add(tag);
                tag = ReadTag();
            }

            return(results);
        }
コード例 #11
0
        public override TagDictionary ReadCompound()
        {
            TagDictionary results;
            Tag           tag;

            results = new TagDictionary();

            tag = this.ReadTag();

            while (tag.Type != TagType.End)
            {
                results.Add(tag);
                tag = this.ReadTag();
            }

            return(results);
        }
コード例 #12
0
        internal override void UpdateLayoutTransitionCore(FrameworkElement child, FrameworkElement root, object tag, TagData newTagData)
        {
            TagData tagData;
            bool    gotData = TagDictionary.TryGetValue(tag, out tagData);

            if (!gotData)
            {
                tagData = new TagData();
                TagDictionary.Add(tag, tagData);
            }

            tagData.ParentRect = newTagData.ParentRect;
            tagData.AppRect    = newTagData.AppRect;
            tagData.Parent     = newTagData.Parent;
            tagData.Child      = newTagData.Child;
            tagData.Timestamp  = newTagData.Timestamp;
        }
コード例 #13
0
ファイル: BexisUIHelper.cs プロジェクト: payamad/Core
        public TextBox()
        {
            // div, input, span

            //div
            TagDictionary.Add(BexisUITagType.div, new Dictionary <string, object>());

            mergeAttribute(BexisUITagType.div, "class", "bx-input-container");

            //input
            TagDictionary.Add(BexisUITagType.input, new Dictionary <string, object>());
            mergeAttribute(BexisUITagType.input, "type", "text");
            mergeAttribute(BexisUITagType.input, "class", "bx-input");

            //span
            TagDictionary.Add(BexisUITagType.span, new Dictionary <string, object>());
            mergeAttribute(BexisUITagType.span, "class", "bx-input-icon");

            //setAttribute(_inputTagBuilder, "data-val", "true");
            //setAttribute(_inputTagBuilder, "data-val-required", "The Name field is required");
        }
コード例 #14
0
        public void Add_adds_named_byte_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;
            byte          expected;
            string        expectedName;

            expectedName = "BetaByte";
            expected     = (byte)(byte.MaxValue >> 1);

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)expected);

            // assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(target.Contains(expectedName));
            Assert.AreEqual(expectedName, actual.Name);
            Assert.AreEqual(expected, actual.GetValue());
        }
コード例 #15
0
        public void Add_adds_named_string_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;
            string        expected;
            string        expectedName;

            expectedName = "BetaString";
            expected     = "HELLO WORLD THIS IS A TEST STRING ÅÄÖ!";

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)expected);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.GetValue());
        }
コード例 #16
0
        public void Add_adds_named_double_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;
            double        expected;
            string        expectedName;

            expectedName = "BetaDouble";
            expected     = 8.98846567431158E+307;

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)expected);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.GetValue());
        }
コード例 #17
0
        public void Add_adds_named_float_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;
            float         expected;
            string        expectedName;

            expectedName = "BetaFloat";
            expected     = 1.701412E+38F;

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)expected);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.GetValue());
        }
コード例 #18
0
        public void Add_adds_named_long_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;
            long          expected;
            string        expectedName;

            expectedName = "BetaLong";
            expected     = 4611686018427387903;

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)expected);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.GetValue());
        }
コード例 #19
0
        public void Add_adds_named_byte()
        {
            // arrange
            TagDictionary target;
            TagByte       actual;
            byte          expected;
            string        expectedName;

            expectedName = "AlphaByte";
            expected     = (byte)(byte.MaxValue >> 1);

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, expected);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.Value);
        }
コード例 #20
0
        public void Add_adds_named_int()
        {
            // arrange
            TagDictionary target;
            TagInt        actual;
            int           expected;
            string        expectedName;

            expectedName = "AlphaInt";
            expected     = 1073741823;

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, expected);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.Value);
        }
コード例 #21
0
        public void Add_adds_named_int_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;
            int           expected;
            string        expectedName;

            expectedName = "BetaInt";
            expected     = 1073741823;

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)expected);

            // assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(target.Contains(expectedName));
            Assert.AreEqual(expectedName, actual.Name);
            Assert.AreEqual(expected, actual.GetValue());
        }
コード例 #22
0
        public void Add_adds_named_long()
        {
            // arrange
            TagDictionary target;
            TagLong       actual;
            long          expected;
            string        expectedName;

            expectedName = "AlphaLong";
            expected     = 4611686018427387903;

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, expected);

            // assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(target.Contains(expectedName));
            Assert.AreEqual(expectedName, actual.Name);
            Assert.AreEqual(expected, actual.Value);
        }
コード例 #23
0
        public void Add_adds_named_float()
        {
            // arrange
            TagDictionary target;
            TagFloat      actual;
            float         expected;
            string        expectedName;

            expectedName = "AlphaFloat";
            expected     = 1.701412E+38F;

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, expected);

            // assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(target.Contains(expectedName));
            Assert.AreEqual(expectedName, actual.Name);
            Assert.AreEqual(expected, actual.Value);
        }
コード例 #24
0
        public void Add_adds_named_double()
        {
            // arrange
            TagDictionary target;
            TagDouble     actual;
            double        expected;
            string        expectedName;

            expectedName = "AlphaDouble";
            expected     = 8.98846567431158E+307;

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, expected);

            // assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(target.Contains(expectedName));
            Assert.AreEqual(expectedName, actual.Name);
            Assert.AreEqual(expected, actual.Value);
        }
コード例 #25
0
        public void Add_adds_named_string()
        {
            // arrange
            TagDictionary target;
            TagString     actual;
            string        expected;
            string        expectedName;

            expectedName = "AlphaString";
            expected     = "HELLO WORLD THIS IS A TEST STRING ÅÄÖ!";

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, expected);

            // assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(target.Contains(expectedName));
            Assert.AreEqual(expectedName, actual.Name);
            Assert.AreEqual(expected, actual.Value);
        }
コード例 #26
0
        public void Add_adds_named_short()
        {
            // arrange
            TagDictionary target;
            TagShort      actual;
            short         expected;
            string        expectedName;

            expectedName = "AlphaShort";
            expected     = (short)(short.MaxValue >> 1);

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, expected);

            // assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(target.Contains(expectedName));
            Assert.AreEqual(expectedName, actual.Name);
            Assert.AreEqual(expected, actual.Value);
        }
コード例 #27
0
        public void Add_adds_named_short_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;
            short         expected;
            string        expectedName;

            expectedName = "BetaShort";
            expected     = (short)(short.MaxValue >> 1);

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)expected);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.GetValue());
        }
コード例 #28
0
        public void Add_adds_named_intarray()
        {
            // arrange
            TagDictionary target;
            TagIntArray   actual;

            int[]  expected;
            string expectedName;

            expectedName = "AlphaIntArray";
            expected     = new[] { 2190, 2994, 3248, 4294394 };

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, expected);

            // assert
            Assert.IsNotNull(actual);
            Assert.IsTrue(target.Contains(expectedName));
            Assert.AreEqual(expectedName, actual.Name);
            Assert.AreEqual(expected, actual.Value);
        }
コード例 #29
0
        public void Add_adds_named_bytearray_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;

            byte[] expected;
            string expectedName;

            expectedName = "BetaByteArray";
            expected     = new byte[] { 2, 4, 8, 16, 32, 64, 128 };

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)expected);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.GetValue());
        }
コード例 #30
0
        public void Add_adds_named_intarray_object()
        {
            // arrange
            TagDictionary target;
            Tag           actual;

            int[]  expected;
            string expectedName;

            expectedName = "BetaIntArray";
            expected     = new[] { 2190, 2994, 3248, 4294394 };

            target = new TagDictionary();

            // act
            actual = target.Add(expectedName, (object)expected);

            // assert
            Assert.NotNull(actual);
            Assert.True(target.Contains(expectedName));
            Assert.Equal(expectedName, actual.Name);
            Assert.Equal(expected, actual.GetValue());
        }
コード例 #31
0
    public override TagDictionary ReadDictionary(TagCompound owner)
    {
      TagDictionary results;
      ITag tag;

      results = new TagDictionary(owner);

      tag = this.Read();
      while (tag.Type != TagType.End)
      {
        results.Add(tag);
        tag = this.Read();
      }

      return results;
    }