public void GetAsStructureValue_WithoutPropertyKey_Fails(string propertyKey) { // Arrange var properties = new ReadOnlyDictionary <string, LogEventPropertyValue>( new Dictionary <string, LogEventPropertyValue>()); // Act / Assert Assert.ThrowsAny <ArgumentException>(() => properties.GetAsStructureValue(propertyKey)); }
public void GetAsStructureValue_WithFoundPropertyWithoutAssociatedStructureValue_Succeeds() { string propertyKey = _bogusGenerator.Random.Word(); var properties = new ReadOnlyDictionary <string, LogEventPropertyValue>( new Dictionary <string, LogEventPropertyValue> { [propertyKey] = new ScalarValue("some value") }); // Act StructureValue result = properties.GetAsStructureValue(propertyKey); // Assert Assert.NotNull(result); Assert.Empty(result.Properties); }
public void GetAsStructureValue_WithFoundPropertyKeyAssociatedWithStructureValue_Succeeds() { // Arrange string propertyKey = _bogusGenerator.Random.Word(); var expected = new StructureValue(new LogEventProperty[0]); var properties = new ReadOnlyDictionary <string, LogEventPropertyValue>( new Dictionary <string, LogEventPropertyValue> { [propertyKey] = expected }); // Act StructureValue actual = properties.GetAsStructureValue(propertyKey); // Assert Assert.Same(expected, actual); }