コード例 #1
0
            public void MatchesOriginal()
            {
                ApplicationDataPath original = new ApplicationDataPath();
                original.Prepend("Bar", 42);
                original.Prepend("Foo", 10);

                ApplicationDataPath copy = new ApplicationDataPath(original);

                Assert.AreEqual(original.Count, copy.Count);
                Assert.AreEqual(original.Last().Name, copy.Last().Name);
                Assert.AreEqual(original.Last().Index, copy.Last().Index);
            }
コード例 #2
0
            public void IsNotOriginal()
            {
                ApplicationDataPath original = new ApplicationDataPath();
                original.Prepend("Bar", 42);
                original.Prepend("Foo", 10);

                ApplicationDataPath copy = new ApplicationDataPath(original);

                copy.TraverseDown();

                Assert.AreNotEqual(original.Count, copy.Count);
            }
コード例 #3
0
 /// <summary>
 /// Recurses up through the control tree and adds any repeater controls to <paramref name="path"/>.
 /// </summary>
 /// <param name="control">The control which acts as the this instance.</param>
 /// <param name="controlList">The control list.</param>
 /// <param name="path">A <see cref="ApplicationDataPath"/> to update.</param>
 private static void CreatePathTemplate(this Control control, ControlList controlList, ApplicationDataPath path)
 {
     Control parent = control.GetRepeaterAncestor(controlList);
     if (parent != null)
     {
         path.Prepend(parent.Name);
         parent.CreatePathTemplate(controlList, path);
     }
 }
コード例 #4
0
            public void TraverseTreeBottom()
            {
                Application application = new Application();
                application.ApplicationData.Add("RootChild", "RootChild Value");

                var outerRepeater = new List<Dictionary<string, object>> { new Dictionary<string, object>() };
                var innerRepeater = new List<Dictionary<string, object>> { new Dictionary<string, object>() };

                innerRepeater[0].Add("InnerChild", "InnerChild Value");
                outerRepeater[0].Add("InnerRepeater", innerRepeater.ToArray());
                outerRepeater[0].Add("OuterChild", "OuterChild Value");
                application.ApplicationData.Add("OuterRepeater", outerRepeater.ToArray());

                ApplicationDataPath path = new ApplicationDataPath();
                path.Prepend("InnerRepeater", 0);
                path.Prepend("OuterRepeater", 0);
                string value = application.GetTokenValue("InnerChild", path).ToString();

                Assert.AreEqual("InnerChild Value", value);
            }
コード例 #5
0
 public void TokenAtLevelTwo()
 {
     ApplicationDataPath path = new ApplicationDataPath();
     path.Prepend("Inner", 3);
     path.Prepend("Outer", 2);
     Assert.AreEqual("Outer[2].Inner[3].token", path.ToString("token"));
 }
コード例 #6
0
 public void TokenAtLevelOne()
 {
     ApplicationDataPath path = new ApplicationDataPath();
     path.Prepend("Repeater1", 2);
     Assert.AreEqual("Repeater1[2].token", path.ToString("token"));
 }
コード例 #7
0
 public void HasEmptyIndex()
 {
     ApplicationDataPath path = new ApplicationDataPath();
     path.Prepend("Inner", null);
     Assert.AreEqual("Inner.token", path.ToString("token"));
 }
コード例 #8
0
 public void PrependsToStart()
 {
     ApplicationDataPath path = new ApplicationDataPath();
     path.Prepend("Foo", 42);
     path.Prepend("Bar", 16);
     Assert.AreEqual(42, path.Last().Index);
 }
コード例 #9
0
 public void HasCorrectNumberOfItems()
 {
     ApplicationDataPath path = new ApplicationDataPath();
     path.Prepend("Foo", 42);
     path.Prepend("Bar", 16);
     Assert.AreEqual(2, path.Count);
 }
コード例 #10
0
            public void NestedRepeaterValueUsingIndex()
            {
                Application application = new Application();

                Dictionary<string, object>[] outerRepeater = new Dictionary<string, object>[1];
                outerRepeater[0] = new Dictionary<string, object> { { "child-of-outer-1", "outer 1 text" } };
                Dictionary<string, object>[] innerRepeater = new Dictionary<string, object>[1];
                innerRepeater[0] = new Dictionary<string, object> { { "child-of-inner-1", "inner 1 text 1" }, { "child-of-inner-2", "inner 1 text 2" } };
                outerRepeater[0].Add("child-of-outer-2", innerRepeater);

                application.ApplicationData.Add("control-at-root", "root");
                application.ApplicationData.Add("repeater-at-root", outerRepeater);

                ApplicationDataPath path = new ApplicationDataPath();
                path.Prepend("child-of-outer-2", 0);
                path.Prepend("repeater-at-root", 0);

                string replacedAppValue1 = this.formatterNullDefault.Format(@"{%child-of-inner-2%}", application, new ControlList(), string.Empty, string.Empty, string.Empty, path);
                Assert.AreEqual("inner 1 text 2", replacedAppValue1);
            }