コード例 #1
0
        public void ShouldGetAuditDbContextConfigurationFromXml_ReturnsDefaultIfNonExisting()
        {
            // Arrange
            var configPath = Assembly.GetCallingAssembly().Location;

            // Act
            var auditDbContextConfiguration = AuditDbContextConfigurationManager.GetAuditDbContextConfigurationFromXml(configPath);

            // Assert
            auditDbContextConfiguration.Should().NotBeNull();
            auditDbContextConfiguration.AuditEnabled.Should().BeTrue();
            auditDbContextConfiguration.AuditDateTimeKind.Should().Be(DateTimeKind.Utc);
            auditDbContextConfiguration.AuditTypeInfos.Should().HaveCount(0);
        }
コード例 #2
0
        public void ShouldGetAuditDbContextConfigurationFromXml()
        {
            // Act
            var auditDbContextConfiguration = AuditDbContextConfigurationManager.GetAuditDbContextConfigurationFromXml();

            // Assert
            auditDbContextConfiguration.Should().NotBeNull();
            auditDbContextConfiguration.AuditEnabled.Should().BeTrue();
            auditDbContextConfiguration.AuditDateTimeKind.Should().Be(DateTimeKind.Utc);
            auditDbContextConfiguration.AuditTypeInfos.Should().HaveCount(1);

            var auditTypeInfo = auditDbContextConfiguration.AuditTypeInfos.ElementAt(0);

            auditTypeInfo.AuditEntityType.Should().Be(typeof(EmployeeAudit));
            auditTypeInfo.AuditableEntityType.Should().Be(typeof(Employee));
            auditTypeInfo.AuditProperties.Should().BeEmpty();
        }