public void TestEmptyUsernameThrowsException() { // ARRANGE const EAuditEvent paramAuditEvent = EAuditEvent.OrganisationMaintenance; Guid paramCorrelationId = Guid.NewGuid(); // ACT _ = new AuditHeader( auditEvent: paramAuditEvent, username: string.Empty, correlationId: paramCorrelationId); }
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); }
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); }
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); }