コード例 #1
0
        private void FindByIdLazyIsLazyTest()
        {
            const string aDescription = "description";

            Permission permission1 = _permissionBuilder.Build();
            Permission permission2 = _permissionBuilder.Build();

            _permissionService.Insert(permission1);
            _permissionService.Insert(permission2);

            Group aGroup = _groupBuilder
                           .WithDescription(aDescription)
                           .WithPermissions(_permissionService.FindAll())
                           .Build();

            int   insertedGroupId   = _groupService.Insert(aGroup);
            Group foundByIdLazyMode = _groupService.FindByIdLazyMode(insertedGroupId);

            Assertion.AreEqual(1, _groupService.FindAll().Count);
            Assertion.AreEqual(aDescription, foundByIdLazyMode.Description);
            Assertion.AreEqual(0, foundByIdLazyMode.Permissions.Count);
        }