コード例 #1
0
        public void FetchAll_Loads_GrandChildren_with_correct_Ids()
        {
            var context = GetContext();

            MockList.FetchAll((o, e) =>
            {
                var list = (MockList)e.Object;

                var expectedGrandChildIds =
                    new[]
                {
                    GrandChildList.GrandChildId1,
                    GrandChildList.GrandChildId2,
                    GrandChildList.GrandChildId3
                };

                for (int index = 0; index < list.Count; index++)
                {
                    var child = list[index];
                    context.Assert.IsNotNull(child.GrandChildren);
                    context.Assert.AreEqual(1, child.GrandChildren.Count);
                    context.Assert.AreEqual(expectedGrandChildIds[index], child.GrandChildren[0].Id);
                    context.Assert.AreEqual("Child_Fetch", child.GrandChildren[0].DataPortalMethod);
                }

                context.Assert.Success();
            });

            context.Complete();
        }
コード例 #2
0
        public void FetchAll_Returns_all_3_Elements_and_does_not_throw_any_Exceptions()
        {
            var context = GetContext();

            MockList.FetchAll((o, e) =>
            {
                context.Assert.IsNull(e.Error);
                context.Assert.IsNotNull(e.Object);
                context.Assert.AreEqual(3, e.Object.Count);
                context.Assert.Success();
            });

            context.Complete();
        }
コード例 #3
0
        public void FetchAll_Returns_Elements_with_correctly_assigned_Ids()
        {
            var context = GetContext();

            MockList.FetchAll((o, e) =>
            {
                var list = (MockList)e.Object;
                context.Assert.AreEqual(MockList.MockEditableChildId1, list[0].Id);
                context.Assert.AreEqual("Child_Fetch", list[0].DataPortalMethod);

                context.Assert.AreEqual(MockList.MockEditableChildId2, list[1].Id);
                context.Assert.AreEqual("Child_Fetch", list[1].DataPortalMethod);

                context.Assert.AreEqual(MockList.MockEditableChildId3, list[2].Id);
                context.Assert.AreEqual("Child_Fetch", list[2].DataPortalMethod);

                context.Assert.Success();
            });

            context.Complete();
        }