Пример #1
0
        public void TestEmptyUsernameThrowsException()
        {
            // ARRANGE
            const EAuditEvent paramAuditEvent = EAuditEvent.OrganisationMaintenance;
            Guid paramCorrelationId           = Guid.NewGuid();

            // ACT
            _ = new AuditHeader(
                auditEvent: paramAuditEvent,
                username: string.Empty,
                correlationId: paramCorrelationId);
        }
Пример #2
0
        public void TestLongUsernameThrowsException()
        {
            // ARRANGE
            const EAuditEvent paramAuditEvent = EAuditEvent.OrganisationMaintenance;
            string            paramUsername   = new string('x', 500);
            Guid paramCorrelationId           = Guid.NewGuid();

            // ACT
            _ = new AuditHeader(
                auditEvent: paramAuditEvent,
                username: paramUsername,
                correlationId: paramCorrelationId);
        }
Пример #3
0
        public void TestEmptyAuditHeaderIdThrowsException()
        {
            // ARRANGE
            const EAuditEvent paramAuditEvent = EAuditEvent.OrganisationMaintenance;
            DateTime          paramTimeStamp  = DateTime.Now;
            const string      paramUsername   = "******";
            Guid paramCorrelationId           = Guid.NewGuid();

            // ACT
            _ = new AuditHeader(
                id: Guid.Empty,
                auditEvent: paramAuditEvent,
                timeStamp: paramTimeStamp,
                username: paramUsername,
                correlationId: paramCorrelationId);
        }
Пример #4
0
        public void TestShortConstructorWithValidValues()
        {
            // ARRANGE
            const EAuditEvent paramAuditEvent = EAuditEvent.OrganisationMaintenance;
            const string      paramUsername   = "******";
            Guid paramCorrelationId           = Guid.NewGuid();

            // ACT
            IAuditHeader auditHeader = new AuditHeader(
                auditEvent: paramAuditEvent,
                username: paramUsername,
                correlationId: paramCorrelationId);

            // ASSERT
            double seconds = (DateTime.Now - auditHeader.TimeStamp).TotalSeconds;

            Assert.AreNotEqual(Guid.Empty, auditHeader.Id);
            Assert.AreEqual(paramAuditEvent, auditHeader.AuditEvent);
            Assert.IsTrue(seconds >= 0 && seconds <= 5);
            Assert.AreEqual(paramUsername, auditHeader.Username);
            Assert.AreNotEqual(Guid.Empty, auditHeader.CorrelationId);
            Assert.AreEqual(paramCorrelationId, auditHeader.CorrelationId);
        }