public void Should_be_possible_to_collect_a_builtin_account()
        {
            var fakeWmiProvider = GetWmiProviderMock(EVERYONE_USERNAME, false, new string[] { "group1", "group1" });
            
            var result = new WindowsUsersProvider(fakeWmiProvider, null).GetUserByName(EVERYONE_USERNAME);

            AssertCollectedWindowsAccount(result, EVERYONE_USERNAME, true);
            CheckIfWmiProviderWasUsedProperly(fakeWmiProvider, ExpectedWqlToGetBuiltinAccount);
        }
        public void Should_be_possible_to_collect_a_local_or_domain_account()
        {
            var fakeUsername = String.Format("{0}\\{1}", FAKE_COMPUTER_NAME, FAKE_USERNAME);
            var fakeWmiProvider = GetWmiProviderMock(fakeUsername, true, null);

            var result = new WindowsUsersProvider(fakeWmiProvider, null).GetUserByName(fakeUsername);

            AssertCollectedWindowsAccount(result, fakeUsername, false);
            CheckIfWmiProviderWasUsedProperly(fakeWmiProvider, ExpectedWqlToGetAnyAccount);
        }
示例#3
0
        protected override void ConfigureObjectCollector()
        {
            if (ObjectCollector == null)
            {
                var wmiScope = ((FileConnectionProvider)ConnectionProvider).ConnectionScope;
                var accountProvider = new WindowsUsersProvider(new WmiDataProvider(wmiScope), this.TargetInfo);

                ItemTypeGenerator = new UserSID55ItemTypeGenerator(accountProvider);
                ObjectCollector = new UserSID55ObjectCollector(accountProvider);
            }
        }
示例#4
0
 protected override void ConfigureObjectCollector()
 {
     if (this.ObjectCollector == null)
     {
         var wmiProvider = new WmiDataProvider(((FileConnectionProvider)ConnectionProvider).ConnectionScope);
         var accountProvider = new WindowsUsersProvider(wmiProvider, this.TargetInfo);
         
         ObjectCollector = new UserObjectCollector(accountProvider);
         if (ItemTypeGenerator == null)
             ItemTypeGenerator = new UserItemTypeGenerator(accountProvider);
     }
 }
        public void If_not_possible_to_get_user_details_through_wmi_only_the_username_should_be_returned()
        {
            var fakeWmiProvider = GetWmiProviderMockWithNoWmiResultBehavior();

            var result = new WindowsUsersProvider(fakeWmiProvider, null).GetAllGroupByUsers();

            Assert.AreEqual(1, result.Count());
            var userAccountToAssert = result.Single();
            AssertCollectedWindowsAccount(userAccountToAssert, "fakeUser");
            
            var groups = userAccountToAssert.Members;
            Assert.AreEqual(3, groups.Count());
            var firstGroup = groups.ElementAt(0);
            Assert.AreEqual("Administrators", firstGroup.Name);
            Assert.IsNull(firstGroup.Enabled);
        }
示例#6
0
 public UserObjectCollector(WindowsUsersProvider windowsAccountProvider)
 {
     this.WindowsAccountProvider = windowsAccountProvider;
 }
 public AccessTokenItemTypeGenerator(WindowsUsersProvider accountProvider)
 {
     this.WindowsAccountProvider = accountProvider;
 }
 //public TargetInfo TargetInfo { get; set; }
 //public UserSID55ObjectCollector SystemDataSource { get; set; }
 public UserSID55ItemTypeGenerator(WindowsUsersProvider windowsAccountProvider)
 {
     this.WindowsAccountProvider = windowsAccountProvider;
 }
示例#9
0
 private void CreateItemTypeGeneratorInstance()
 {
     if (base.ItemTypeGenerator == null)
     {
         var newWmiDataProvider = new WmiDataProvider(this.WMIConnectionProvider.ConnectionScope);
         var newAccountProvider = new WindowsUsersProvider(newWmiDataProvider, this.TargetInfo);
         base.ItemTypeGenerator = new AccessTokenItemTypeGenerator(newAccountProvider);
     }
 }
示例#10
0
        public void Should_be_possible_to_handle_not_founded_users()
        {
            var fakeWmiProvider = GetWmiProviderMock(null, true, null);

            var result = new WindowsUsersProvider(fakeWmiProvider, null).GetUserByName("Ghost");
        }
示例#11
0
 public UserSID55ObjectCollector(WindowsUsersProvider accountProvider)
 {
     this.WindowsAccountProvider = accountProvider;
 }