Beispiel #1
0
        public void Should_be_possible_to_create_an_DisabledWindowsUserAccountWithNoGroups_by_builder()
        {
            var winUserAccount =
                new WindowsUserAccountBuilder()
                .WithSID("S-1-15")
                .WithTrusteeName("microsoft\\bgates")
                .Disabled()
                .Build();

            Assert.AreEqual(
                "S-1-15",
                winUserAccount.UserSID,
                UnexpectedPropertyInBuiltObject("UserSID"));

            Assert.AreEqual(
                "microsoft\\bgates",
                winUserAccount.UserTrusteeName,
                UnexpectedPropertyInBuiltObject("UserTrusteeName"));

            Assert.IsNull(
                winUserAccount.GroupSIDs,
                UnexpectedPropertyInBuiltObject("GroupSID"));

            Assert.IsFalse(
                winUserAccount.UserEnabled,
                UnexpectedPropertyInBuiltObject("UserEnabled"));
        }
Beispiel #2
0
        public void Should_be_possible_to_create_an_EnabledWindowsUserAccount_by_builder()
        {
            var winUserAccount =
                new WindowsUserAccountBuilder()
                .WithSID("S-1-15")
                .WithTrusteeName("mss\\lfernandes")
                .WithGroups(new string[] { "S-1-20", "S-1-25", "S-1-30" })
                .Build();

            Assert.AreEqual(
                "S-1-15",
                winUserAccount.UserSID,
                UnexpectedPropertyInBuiltObject("UserSID"));

            Assert.AreEqual(
                "mss\\lfernandes",
                winUserAccount.UserTrusteeName,
                UnexpectedPropertyInBuiltObject("UserTrusteeName"));

            Assert.AreEqual(
                "S-1-20",
                winUserAccount.GroupSIDs.ElementAt(0),
                UnexpectedPropertyInBuiltObject("GroupSID[0]"));

            Assert.AreEqual(
                "S-1-25",
                winUserAccount.GroupSIDs.ElementAt(1),
                UnexpectedPropertyInBuiltObject("GroupSID[1]"));

            Assert.AreEqual(
                "S-1-30",
                winUserAccount.GroupSIDs.ElementAt(2),
                UnexpectedPropertyInBuiltObject("GroupSID[2]"));

            Assert.IsTrue(
                winUserAccount.UserEnabled,
                UnexpectedPropertyInBuiltObject("UserEnabled"));
        }