Exemplo n.º 1
0
        public void Non_Generic_Instance_With_Description()
        {
            // Arrange
            var auditEvent = AuditEvent.AsViewOf(_testCustomer.GetType(), _testCustomer.Id.ToString());

            // Act
            auditEvent.WithDescription(TestHelpers.Description);

            // Assert
            auditEvent.Description.Should().Be(TestHelpers.Description);
        }
Exemplo n.º 2
0
        public void Non_Generic_Instance_As_Event()
        {
            // Arrange
            var auditEvent = AuditEvent.AsViewOf(_testCustomer.GetType(), _testCustomer.Id.ToString());

            // Act
            auditEvent.AsEvent(TestHelpers.EventName);

            // Assert
            auditEvent.EventType.Should().Be(TestHelpers.EventName);
        }
Exemplo n.º 3
0
        public void Non_Generic_Instance_With_No_Data()
        {
            // Arrange
            var auditEvent = AuditEvent.AsViewOf(_testCustomer.GetType(), _testCustomer.Id.ToString());

            // Act
            auditEvent.WithNoData();

            // Assert
            auditEvent.DataId.Should().Be(null);
            auditEvent.DataType.Should().Be(null);
            auditEvent.Data.Should().Be(null);
        }
Exemplo n.º 4
0
        public void Create_Instance_Generic()
        {
            // Arrange

            // Act
            var auditEvent = AuditEvent.AsViewOf(_testCustomer, tc => tc.Id.ToString());

            // Assert
            auditEvent.OperationType.Should().Be(OperationType.View);
            auditEvent.TargetId.Should().Be(_testCustomer.Id.ToString());
            auditEvent.TargetType.Should().Be(_testCustomer.GetType().Name);
            auditEvent.Timestamp.Should().NotBe(default(DateTime));
        }
Exemplo n.º 5
0
        public void Generic_Instance_With_Data()
        {
            // Arrange
            var auditEvent = AuditEvent.AsViewOf(_testCustomer, tc => tc.Id.ToString());

            // Act
            auditEvent.WithData(_testCustomer, tc => tc.Id.ToString());

            // Assert
            auditEvent.DataId.Should().Be(_testCustomer.Id.ToString());
            auditEvent.DataType.Should().Be(_testCustomer.GetType().FullName);
            auditEvent.Data.Should().Be(_testCustomerJson);
            auditEvent.IsSensitiveData.Should().Be(false);
        }