Catbert4.Tests.Controllers.UserManagementControllerTests.UserManagementControllerTests.TestCanUserManageGivenLogin5 C# (CSharp) Метод

TestCanUserManageGivenLogin5() приватный Метод

private TestCanUserManageGivenLogin5 ( ) : void
Результат void
        public void TestCanUserManageGivenLogin5()
        {
            #region Arrange
            UserService = new UserService(UnitService, UnitAssociationRepository, PermissionRepository);
            ControllerRecordFakes.FakeUnits(6, UnitRepository);
            ControllerRecordFakes.FakeRoles(6, RoleRepository);
            ControllerRecordFakes.FakeApplications(3, ApplicationRepository);
            ControllerRecordFakes.FakeUsers(6, UserRepository);

            //These are the units that the current user has if he has the correct access
            UnitService.Expect(a => a.GetVisibleByUser("Name1", "UserName")).Return(UnitRepository.Queryable.Where(a => a.Id == 2 || a.Id == 4)).Repeat.Any();

            var unitAssociations = new List<UnitAssociation>();
            for (int i = 0; i < 5; i++)
            {
                unitAssociations.Add(CreateValidEntities.UnitAssociation(i + 1));
                unitAssociations[i].User = UserRepository.GetNullableById(i + 1);
                unitAssociations[i].Application = ApplicationRepository.GetNullableById(2); //Different app
                unitAssociations[i].Unit = UnitRepository.GetNullableById(2);
            }
            ControllerRecordFakes.FakeUnitAssociations(0, UnitAssociationRepository, unitAssociations);
            #endregion Arrange

            #region Act
            var result = UserService.CanUserManageGivenLogin("Name1", "UserName", "LoginId2");
            #endregion Act

            #region Assert
            Assert.IsFalse(result);
            #endregion Assert
        }
UserManagementControllerTests