コード例 #1
0
        public void GetBySid_Should_Fetch_LocalGroup_When_HasNot_AssignedMembers()
        {
            // arrange
            string groupName = _generator.RandomName;

            _groupInstaller.Install(groupName);
            var sid = LocalGroupHelper.GetSid(groupName);

            // act
            var group = _shell.GetBySid(sid);

            // assert
            group.Name.Should().Be(groupName);
            group.Members.Should().BeEmpty();
            group.Description.Should().Be(_groupInstaller.Description);
        }
コード例 #2
0
        public void GetBySid_Should_Fetch_LocalGroup_When_Has_AssignedMembers()
        {
            // arrange
            string groupName = _generator.RandomName;
            string userName  = _generator.RandomName;
            string userName2 = _generator.RandomName;

            _groupInstaller.Install(groupName);
            _userInstaller.Install(userName, _generator.RandomName);
            _userInstaller.Install(userName2, _generator.RandomName);

            LocalGroupHelper.AssignUser(groupName, userName);
            LocalGroupHelper.AssignUser(groupName, userName2);

            var sid = LocalGroupHelper.GetSid(groupName);
            // act
            var group = _shell.GetBySid(sid);

            // assert
            group.Members.Should().Contain(p => p == userName);
            group.Members.Should().Contain(p => p == userName2);
        }