public void Logs_DockerEphemeralFolders() { // Arrange var loggerFactory = new StringLoggerFactory(LogLevel.Warning); WithUniqueTempDirectory(dirInfo => { // Act var repo = new FileSystemXmlRepository(dirInfo, loggerFactory); // Assert Assert.Contains(Resources.FormatFileSystem_EphemeralKeysLocationInContainer(dirInfo.FullName), loggerFactory.ToString()); }); }
public void GetAllKeys_WithKeyDeserializationError_LogLevelTrace_WritesSensitiveInformation() { // Arrange const string xml = @" <root> <!-- The below key will throw an exception when deserializing. --> <key id='78cd498e-9375-4e55-ac0d-d79527ecd09d' version='1'> <creationDate>2015-01-01T00:00:00Z</creationDate> <activationDate>2015-02-01T00:00:00Z</activationDate> <expirationDate>NOT A VALID DATE</expirationDate> <!-- Secret information: 1A2B3C4D --> </key> </root>"; var loggerFactory = new StringLoggerFactory(LogLevel.Trace); // Act RunGetAllKeysCore(xml, new Mock <IActivator>().Object, loggerFactory).ToArray(); // Assert Assert.True(loggerFactory.ToString().Contains("1A2B3C4D"), "The secret '1A2B3C4D' should have been logged."); }
public void GetAllKeys_WithKeyDeserializationError_LogLevelTrace_WritesSensitiveInformation() { // Arrange const string xml = @" <root> <!-- The below key will throw an exception when deserializing. --> <key id='78cd498e-9375-4e55-ac0d-d79527ecd09d' version='1'> <creationDate>2015-01-01T00:00:00Z</creationDate> <activationDate>2015-02-01T00:00:00Z</activationDate> <expirationDate>NOT A VALID DATE</expirationDate> <!-- Secret information: 1A2B3C4D --> </key> </root>"; var loggerFactory = new StringLoggerFactory(LogLevel.Trace); // Act RunGetAllKeysCore(xml, new Mock<IActivator>().Object, loggerFactory).ToArray(); // Assert Assert.True(loggerFactory.ToString().Contains("1A2B3C4D"), "The secret '1A2B3C4D' should have been logged."); }
public StringLogger(string name, StringLoggerFactory factory) { _name = name; _factory = factory; }