private void AssertAllAuditEventPolicyEntities(auditeventpolicy_item generatedItem)
 {
     this.AssertGeneratedAuditEventPolicyItem(generatedItem.account_logon, "account_logon");
     this.AssertGeneratedAuditEventPolicyItem(generatedItem.account_management, "account_management");
     this.AssertGeneratedAuditEventPolicyItem(generatedItem.detailed_tracking, "detailed_tracking");
     this.AssertGeneratedAuditEventPolicyItem(generatedItem.directory_service_access, "directory_service_access");
     this.AssertGeneratedAuditEventPolicyItem(generatedItem.logon, "logon");
     this.AssertGeneratedAuditEventPolicyItem(generatedItem.object_access, "object_access");
     this.AssertGeneratedAuditEventPolicyItem(generatedItem.policy_change, "policy_change");
     this.AssertGeneratedAuditEventPolicyItem(generatedItem.privilege_use, "privilege_use");
     this.AssertGeneratedAuditEventPolicyItem(generatedItem.system, "system");
 }
        public AuditEventPolicyProberTest()
        {
            this.FakeContext = ProbeHelper.CreateFakeContext();
            this.FakeTargetInfo = ProbeHelper.CreateFakeTarget();
            this.FakeItemsToCollect = new ItemType[] { new auditeventpolicy_item() };

            var fakeAuditEventPolicyItem = new auditeventpolicy_item();
            fakeAuditEventPolicyItem.CreateAllEntityItemsWithAuditNoneEventStatus();
            fakeAuditEventPolicyItem.detailed_tracking.Value = AuditEventStatus.AUDIT_SUCCESS_FAILURE.ToString();
            this.FakeCollectedItems = new CollectedItem[] { ProbeHelper.CreateFakeCollectedItem(fakeAuditEventPolicyItem) };

            var objects = new Definitions.ObjectType[] { ProbeHelper.GetDefinitionObjectTypeByID("definitionsSimple", "2100") };
            this.FakeCollectInfo = ProbeHelper.CreateFakeCollectInfo(objects, null, null);
        }
 private auditeventpolicy_item createAuditEventPolicyWithAllEntities()
 {
     var newAuditEventPolicyItem = new auditeventpolicy_item();
     newAuditEventPolicyItem.CreateAllEntityItems();
     return newAuditEventPolicyItem;
 }
 private void AssertAllAuditEventPolicyEntitiesAreNotNull(auditeventpolicy_item collectedItem)
 {
     Assert.IsNotNull(collectedItem.account_logon, GetAssertFailedMessageForNullEntity("account_logon"));
     Assert.IsNotNull(collectedItem.account_management, GetAssertFailedMessageForNullEntity("account_management"));
     Assert.IsNotNull(collectedItem.detailed_tracking, GetAssertFailedMessageForNullEntity("detailed_tracking"));
     Assert.IsNotNull(collectedItem.directory_service_access, GetAssertFailedMessageForNullEntity("directory_service_access"));
     Assert.IsNotNull(collectedItem.logon, GetAssertFailedMessageForNullEntity("logon"));
     Assert.IsNotNull(collectedItem.object_access, GetAssertFailedMessageForNullEntity("object_access"));
     Assert.IsNotNull(collectedItem.policy_change, GetAssertFailedMessageForNullEntity("policy_change"));
     Assert.IsNotNull(collectedItem.privilege_use, GetAssertFailedMessageForNullEntity("privilege_use"));
     Assert.IsNotNull(collectedItem.system, GetAssertFailedMessageForNullEntity("system"));
 }
        private void AssertAllEntitiesWasCreated(auditeventpolicy_item auditEventPolicyItem, AuditEventStatus withDefaultValue)
        {
            Assert.IsNotNull(auditEventPolicyItem.account_logon, string.Format(UNEXPECTED_NULL_ENTITY_WAS_FOUND, "account_logon"));
            Assert.IsNotNull(auditEventPolicyItem.account_management, string.Format(UNEXPECTED_NULL_ENTITY_WAS_FOUND, "account_management"));
            Assert.IsNotNull(auditEventPolicyItem.detailed_tracking, string.Format(UNEXPECTED_NULL_ENTITY_WAS_FOUND, "detailed_tracking"));
            Assert.IsNotNull(auditEventPolicyItem.directory_service_access, string.Format(UNEXPECTED_NULL_ENTITY_WAS_FOUND, "directory_service_access"));
            Assert.IsNotNull(auditEventPolicyItem.logon, string.Format(UNEXPECTED_NULL_ENTITY_WAS_FOUND, "logon"));
            Assert.IsNotNull(auditEventPolicyItem.object_access, string.Format(UNEXPECTED_NULL_ENTITY_WAS_FOUND, "object_access"));
            Assert.IsNotNull(auditEventPolicyItem.policy_change, string.Format(UNEXPECTED_NULL_ENTITY_WAS_FOUND, "policy_change"));
            Assert.IsNotNull(auditEventPolicyItem.privilege_use, string.Format(UNEXPECTED_NULL_ENTITY_WAS_FOUND, "privilege_use"));
            Assert.IsNotNull(auditEventPolicyItem.system, string.Format(UNEXPECTED_NULL_ENTITY_WAS_FOUND, "system"));

            if (withDefaultValue != AuditEventStatus.EMPTY)
            {
                Assert.AreEqual(withDefaultValue.ToString(), auditEventPolicyItem.account_logon.Value);
                Assert.AreEqual(withDefaultValue.ToString(), auditEventPolicyItem.account_management.Value);
                Assert.AreEqual(withDefaultValue.ToString(), auditEventPolicyItem.detailed_tracking.Value);
                Assert.AreEqual(withDefaultValue.ToString(), auditEventPolicyItem.directory_service_access.Value);
                Assert.AreEqual(withDefaultValue.ToString(), auditEventPolicyItem.logon.Value);
                Assert.AreEqual(withDefaultValue.ToString(), auditEventPolicyItem.object_access.Value);
                Assert.AreEqual(withDefaultValue.ToString(), auditEventPolicyItem.policy_change.Value);
                Assert.AreEqual(withDefaultValue.ToString(), auditEventPolicyItem.privilege_use.Value);
                Assert.AreEqual(withDefaultValue.ToString(), auditEventPolicyItem.system.Value);
            }
        }
 private void AssertAllEntitiesIsNull(auditeventpolicy_item auditEventItem)
 {
     Assert.IsNull(auditEventItem.account_logon, string.Format(UNEXPECTED_NOTNULL_ENTITY_WAS_FOUND, "account_logon"));
     Assert.IsNull(auditEventItem.account_management, string.Format(UNEXPECTED_NOTNULL_ENTITY_WAS_FOUND, "account_management"));
     Assert.IsNull(auditEventItem.detailed_tracking, string.Format(UNEXPECTED_NOTNULL_ENTITY_WAS_FOUND, "detailed_tracking"));
     Assert.IsNull(auditEventItem.directory_service_access, string.Format(UNEXPECTED_NOTNULL_ENTITY_WAS_FOUND, "directory_service_access"));
     Assert.IsNull(auditEventItem.logon, string.Format(UNEXPECTED_NOTNULL_ENTITY_WAS_FOUND, "logon"));
     Assert.IsNull(auditEventItem.object_access, string.Format(UNEXPECTED_NOTNULL_ENTITY_WAS_FOUND, "object_access"));
     Assert.IsNull(auditEventItem.policy_change, string.Format(UNEXPECTED_NOTNULL_ENTITY_WAS_FOUND, "policy_change"));
     Assert.IsNull(auditEventItem.privilege_use, string.Format(UNEXPECTED_NOTNULL_ENTITY_WAS_FOUND, "privilege_use"));
     Assert.IsNull(auditEventItem.system, string.Format(UNEXPECTED_NOTNULL_ENTITY_WAS_FOUND, "system"));
 }
        public void Should_be_possible_to_create_all_audit_entities_with_default_audit_event_status_for_an_auditeventpolicy_item()
        {
            var newAuditEventPolicyItem = new auditeventpolicy_item();
            newAuditEventPolicyItem.CreateAllEntityItemsWithAuditNoneEventStatus();

            AssertAllEntitiesWasCreated(newAuditEventPolicyItem, AuditEventStatus.AUDIT_NONE);
        }
        public void Should_be_possible_to_create_all_audit_entities_for_an_auditeventpolicy_item()
        {
            var newAuditEventPolicyItem = new auditeventpolicy_item();
            AssertAllEntitiesIsNull(newAuditEventPolicyItem);

            newAuditEventPolicyItem.CreateAllEntityItems();
            AssertAllEntitiesWasCreated(newAuditEventPolicyItem, AuditEventStatus.EMPTY);
        }
 private ItemType createAuditEventPolicyItemType()
 {
     var newAuditEventPolicyItem = new auditeventpolicy_item();
     newAuditEventPolicyItem.CreateAllEntityItems();
     return newAuditEventPolicyItem;
 }