From 67e5314fa46d561c567ba6dbaffe18a950aed772 Mon Sep 17 00:00:00 2001 From: Nicholas Blumhardt Date: Sun, 29 Mar 2015 18:53:59 +1000 Subject: [PATCH] Removed Serilog.Extras.FSharp and Serilog.Extras.DestructureByIgnoring - these are now in https://github.com/destructurama (#414). --- Serilog.sln | 21 ----- .../DestructureByIgnoringPolicy.cs | 87 ------------------ .../IgnoredPropertyExpressionExtensions.cs | 58 ------------ .../LoggerConfigurationIgnoreExtensions.cs | 39 -------- .../Properties/AssemblyInfo.cs | 5 -- ...erilog.Extras.DestructureByIgnoring.csproj | 78 ---------------- ...erilog.Extras.DestructureByIgnoring.nuspec | 17 ---- .../Serilog.Extras.FSharp.fsproj | 68 -------------- .../Serilog.Extras.FSharp.nuspec | 22 ----- .../SerilogExtrasFSharp.fs | 51 ----------- .../DestructureByIgnoringTests.cs | 88 ------------------- .../Properties/AssemblyInfo.cs | 35 -------- ....Extras.DestructureByIgnoring.Tests.csproj | 79 ----------------- .../packages.config | 4 - 14 files changed, 652 deletions(-) delete mode 100644 src/Serilog.Extras.DestructureByIgnoring/Extras/DestructureByIgnoring/DestructureByIgnoringPolicy.cs delete mode 100644 src/Serilog.Extras.DestructureByIgnoring/Extras/DestructureByIgnoring/IgnoredPropertyExpressionExtensions.cs delete mode 100644 src/Serilog.Extras.DestructureByIgnoring/LoggerConfigurationIgnoreExtensions.cs delete mode 100644 src/Serilog.Extras.DestructureByIgnoring/Properties/AssemblyInfo.cs delete mode 100644 src/Serilog.Extras.DestructureByIgnoring/Serilog.Extras.DestructureByIgnoring.csproj delete mode 100644 src/Serilog.Extras.DestructureByIgnoring/Serilog.Extras.DestructureByIgnoring.nuspec delete mode 100644 src/Serilog.Extras.FSharp/Serilog.Extras.FSharp.fsproj delete mode 100644 src/Serilog.Extras.FSharp/Serilog.Extras.FSharp.nuspec delete mode 100644 src/Serilog.Extras.FSharp/SerilogExtrasFSharp.fs delete mode 100644 test/Serilog.Extras.DestructureByIgnoring.Tests/DestructureByIgnoringTests.cs delete mode 100644 test/Serilog.Extras.DestructureByIgnoring.Tests/Properties/AssemblyInfo.cs delete mode 100644 test/Serilog.Extras.DestructureByIgnoring.Tests/Serilog.Extras.DestructureByIgnoring.Tests.csproj delete mode 100644 test/Serilog.Extras.DestructureByIgnoring.Tests/packages.config diff --git a/Serilog.sln b/Serilog.sln index 6d6497ed1..b866992a8 100644 --- a/Serilog.sln +++ b/Serilog.sln @@ -36,12 +36,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.SmokeTest", "test\S EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Extras.AppSettings.Tests", "test\Serilog.Extras.AppSettings.Tests\Serilog.Extras.AppSettings.Tests.csproj", "{67398D2A-0829-4373-ABC5-2161FEB28A05}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Extras.DestructureByIgnoring", "src\Serilog.Extras.DestructureByIgnoring\Serilog.Extras.DestructureByIgnoring.csproj", "{C5CC62F4-310F-495C-96EA-B8E5D26F8D57}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Extras.DestructureByIgnoring.Tests", "test\Serilog.Extras.DestructureByIgnoring.Tests\Serilog.Extras.DestructureByIgnoring.Tests.csproj", "{977E42C3-D501-4730-98FF-525B753B1E3A}" -EndProject -Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Serilog.Extras.FSharp", "src\Serilog.Extras.FSharp\Serilog.Extras.FSharp.fsproj", "{088A4030-7C7A-4434-964A-8E9E42DB17F0}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.MsTests", "test\Serilog.MsTests\Serilog.MsTests.csproj", "{7FC9FC46-5014-4461-A448-815E6CCE21E5}" EndProject Global @@ -90,18 +84,6 @@ Global {67398D2A-0829-4373-ABC5-2161FEB28A05}.Debug|Any CPU.Build.0 = Debug|Any CPU {67398D2A-0829-4373-ABC5-2161FEB28A05}.Release|Any CPU.ActiveCfg = Release|Any CPU {67398D2A-0829-4373-ABC5-2161FEB28A05}.Release|Any CPU.Build.0 = Release|Any CPU - {C5CC62F4-310F-495C-96EA-B8E5D26F8D57}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C5CC62F4-310F-495C-96EA-B8E5D26F8D57}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C5CC62F4-310F-495C-96EA-B8E5D26F8D57}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C5CC62F4-310F-495C-96EA-B8E5D26F8D57}.Release|Any CPU.Build.0 = Release|Any CPU - {977E42C3-D501-4730-98FF-525B753B1E3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {977E42C3-D501-4730-98FF-525B753B1E3A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {977E42C3-D501-4730-98FF-525B753B1E3A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {977E42C3-D501-4730-98FF-525B753B1E3A}.Release|Any CPU.Build.0 = Release|Any CPU - {088A4030-7C7A-4434-964A-8E9E42DB17F0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {088A4030-7C7A-4434-964A-8E9E42DB17F0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {088A4030-7C7A-4434-964A-8E9E42DB17F0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {088A4030-7C7A-4434-964A-8E9E42DB17F0}.Release|Any CPU.Build.0 = Release|Any CPU {7FC9FC46-5014-4461-A448-815E6CCE21E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7FC9FC46-5014-4461-A448-815E6CCE21E5}.Debug|Any CPU.Build.0 = Debug|Any CPU {7FC9FC46-5014-4461-A448-815E6CCE21E5}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -121,9 +103,6 @@ Global {4F81EDAE-2E06-4024-925A-E495C852BDCF} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0} {58563C46-B781-4799-ABD5-9745F94478FD} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0} {67398D2A-0829-4373-ABC5-2161FEB28A05} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0} - {C5CC62F4-310F-495C-96EA-B8E5D26F8D57} = {037440DE-440B-4129-9F7A-09B42D00397E} - {977E42C3-D501-4730-98FF-525B753B1E3A} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0} - {088A4030-7C7A-4434-964A-8E9E42DB17F0} = {037440DE-440B-4129-9F7A-09B42D00397E} {7FC9FC46-5014-4461-A448-815E6CCE21E5} = {0D135C0C-A60B-454A-A2F4-CD74A30E04B0} EndGlobalSection EndGlobal diff --git a/src/Serilog.Extras.DestructureByIgnoring/Extras/DestructureByIgnoring/DestructureByIgnoringPolicy.cs b/src/Serilog.Extras.DestructureByIgnoring/Extras/DestructureByIgnoring/DestructureByIgnoringPolicy.cs deleted file mode 100644 index 3dd3b61b2..000000000 --- a/src/Serilog.Extras.DestructureByIgnoring/Extras/DestructureByIgnoring/DestructureByIgnoringPolicy.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2014 Serilog Contributors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Expressions; -using System.Reflection; -using Serilog.Core; -using Serilog.Debugging; -using Serilog.Events; - -namespace Serilog.Extras.DestructureByIgnoring -{ - class DestructureByIgnoringPolicy : IDestructuringPolicy - { - private readonly IEnumerable _propertiesToInclude; - private readonly Type _destructureType; - - public DestructureByIgnoringPolicy(params Expression>[] ignoredProperties) - { - _destructureType = typeof(TDestructure); - var namesOfPropertiesToIgnore = ignoredProperties.Select(GetNameOfPropertyToIgnore).ToArray(); - var runtimeProperties = _destructureType.GetRuntimeProperties(); - - _propertiesToInclude = runtimeProperties.Where(p => !namesOfPropertiesToIgnore.Contains(p.Name)).ToArray(); - } - - public bool TryDestructure(object value, ILogEventPropertyValueFactory propertyValueFactory, out LogEventPropertyValue result) - { - if (value == null || value.GetType() != typeof(TDestructure)) - { - result = null; - return false; - } - - result = BuildStructure(value, propertyValueFactory); - - return true; - } - - private LogEventPropertyValue BuildStructure(object value, ILogEventPropertyValueFactory propertyValueFactory) - { - var structureProperties = new List(); - foreach (var propertyInfo in _propertiesToInclude) - { - object propertyValue; - try - { - propertyValue = propertyInfo.GetValue(value); - } - catch (TargetInvocationException ex) - { - SelfLog.WriteLine("The property accessor {0} threw exception {1}", propertyInfo, ex); - propertyValue = "The property accessor threw an exception: " + ex.InnerException.GetType().Name; - } - - var logEventPropertyValue = BuildLogEventProperty(propertyValue, propertyValueFactory); - - structureProperties.Add(new LogEventProperty(propertyInfo.Name, logEventPropertyValue)); - } - - return new StructureValue(structureProperties, _destructureType.Name); - } - - private static LogEventPropertyValue BuildLogEventProperty(object propertyValue, ILogEventPropertyValueFactory propertyValueFactory) - { - return propertyValue == null ? new ScalarValue(null) : propertyValueFactory.CreatePropertyValue(propertyValue, true); - } - - private static string GetNameOfPropertyToIgnore(Expression> ignoredProperty) - { - return ignoredProperty.GetPropertyNameFromExpression(); - } - } -} diff --git a/src/Serilog.Extras.DestructureByIgnoring/Extras/DestructureByIgnoring/IgnoredPropertyExpressionExtensions.cs b/src/Serilog.Extras.DestructureByIgnoring/Extras/DestructureByIgnoring/IgnoredPropertyExpressionExtensions.cs deleted file mode 100644 index 474086af3..000000000 --- a/src/Serilog.Extras.DestructureByIgnoring/Extras/DestructureByIgnoring/IgnoredPropertyExpressionExtensions.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2014 Serilog Contributors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -using System; -using System.Linq.Expressions; - -namespace Serilog.Extras.DestructureByIgnoring -{ - static class IgnoredPropertyExpressionExtensions - { - private const string expressionNotSupported = "A property name cannot be retrieved from function expression with body of type {0}. " + - "Only function expressions that access a property are currently supported. e.g. obj => obj.Property"; - - public static string GetPropertyNameFromExpression(this Expression> ignoredProperty) - { - var expressionBody = ignoredProperty.Body; - - var memberExpression = GetMemberExpression(expressionBody); - - var isNotSimplePropertyAccess = memberExpression == null || GetMemberExpression(memberExpression.Expression) != null; - if (isNotSimplePropertyAccess) - { - throw new ArgumentException(string.Format(expressionNotSupported, - expressionBody.GetType().Name), "ignoredProperty"); - } - - return memberExpression.Member.Name; - } - - private static MemberExpression GetMemberExpression(Expression expression) - { - return GetMemberExpressionForValueType(expression) ?? GetMemberExpressionForReferenceType(expression); - } - - private static MemberExpression GetMemberExpressionForValueType(Expression expression) - { - var bodyOfExpression = expression as UnaryExpression; - - return bodyOfExpression != null ? bodyOfExpression.Operand as MemberExpression : null; - } - - private static MemberExpression GetMemberExpressionForReferenceType(Expression expression) - { - return expression as MemberExpression; - } - } -} \ No newline at end of file diff --git a/src/Serilog.Extras.DestructureByIgnoring/LoggerConfigurationIgnoreExtensions.cs b/src/Serilog.Extras.DestructureByIgnoring/LoggerConfigurationIgnoreExtensions.cs deleted file mode 100644 index 0985e3772..000000000 --- a/src/Serilog.Extras.DestructureByIgnoring/LoggerConfigurationIgnoreExtensions.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 Serilog Contributors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -using System; -using System.Linq.Expressions; -using Serilog.Configuration; -using Serilog.Extras.DestructureByIgnoring; - -namespace Serilog -{ - /// - /// Adds the Destructure.ByIgnoringProperties() extension to . - /// - public static class LoggerConfigurationIgnoreExtensions - { - /// - /// Destructure.ByIgnoringProperties takes one or more expressions that access a property, e.g. obj => obj.Property, and uses the property names to determine which - /// properties are ignored when an object of type TDestruture is destructured by serilog. - /// - /// The logger configuration to apply configuration to. - /// The function expressions that expose the properties to ignore. - /// An object allowing configuration to continue. - public static LoggerConfiguration ByIgnoringProperties(this LoggerDestructuringConfiguration configuration, params Expression>[] ignoredProperty) - { - return configuration.With(new DestructureByIgnoringPolicy(ignoredProperty)); - } - } -} diff --git a/src/Serilog.Extras.DestructureByIgnoring/Properties/AssemblyInfo.cs b/src/Serilog.Extras.DestructureByIgnoring/Properties/AssemblyInfo.cs deleted file mode 100644 index 4d6d27197..000000000 --- a/src/Serilog.Extras.DestructureByIgnoring/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,5 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("Serilog.Extras.DestructureByIgnoring")] -[assembly: AssemblyProduct("Serilog Lambda-Driven Destructuring Support")] -[assembly: AssemblyCopyright("Copyright © Serilog Contributors 2014")] \ No newline at end of file diff --git a/src/Serilog.Extras.DestructureByIgnoring/Serilog.Extras.DestructureByIgnoring.csproj b/src/Serilog.Extras.DestructureByIgnoring/Serilog.Extras.DestructureByIgnoring.csproj deleted file mode 100644 index a925e9f3d..000000000 --- a/src/Serilog.Extras.DestructureByIgnoring/Serilog.Extras.DestructureByIgnoring.csproj +++ /dev/null @@ -1,78 +0,0 @@ - - - - - 11.0 - Debug - AnyCPU - {C5CC62F4-310F-495C-96EA-B8E5D26F8D57} - Library - Properties - Serilog - Serilog.Extras.DestructureByIgnoring - en-US - 512 - {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - Profile78 - v4.5 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - true - bin\Debug\Serilog.Extras.DestructureByIgnoring.XML - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - true - bin\Release\Serilog.Extras.DestructureByIgnoring.XML - - - true - - - ..\..\assets\Serilog.snk - - - - - Serilog.snk - - - Designer - - - - - - - - - Properties\CommonAssemblyInfo.cs - - - - - {0915dbd9-0f7c-4439-8d9e-74c3d579b219} - Serilog - - - - - \ No newline at end of file diff --git a/src/Serilog.Extras.DestructureByIgnoring/Serilog.Extras.DestructureByIgnoring.nuspec b/src/Serilog.Extras.DestructureByIgnoring/Serilog.Extras.DestructureByIgnoring.nuspec deleted file mode 100644 index 61a6bd9d7..000000000 --- a/src/Serilog.Extras.DestructureByIgnoring/Serilog.Extras.DestructureByIgnoring.nuspec +++ /dev/null @@ -1,17 +0,0 @@ - - - - Serilog.Extras.DestructureByIgnoring - $version$ - Serilog Contributors - Adds support for specifying how complex types are destructured for logging using lamda expressions to ignore specific properties. - en-US - http://serilog.net - http://www.apache.org/licenses/LICENSE-2.0 - http://serilog.net/images/serilog-nuget.png - serilog - - - - - diff --git a/src/Serilog.Extras.FSharp/Serilog.Extras.FSharp.fsproj b/src/Serilog.Extras.FSharp/Serilog.Extras.FSharp.fsproj deleted file mode 100644 index e3e5437f9..000000000 --- a/src/Serilog.Extras.FSharp/Serilog.Extras.FSharp.fsproj +++ /dev/null @@ -1,68 +0,0 @@ - - - - - Debug - AnyCPU - 2.0 - 088a4030-7c7a-4434-964a-8e9e42db17f0 - Library - Serilog.Extras.FSharp - Serilog.Extras.FSharp - v4.5 - Profile7 - netcore - 3.3.1.0 - Serilog.Extras.FSharp - - - true - full - false - false - bin\Debug\ - DEBUG;TRACE - 3 - bin\Debug\Serilog.Extras.FSharp.XML - true - - - - pdbonly - true - true - bin\Release\ - TRACE - 3 - bin\Release\Serilog.Extras.FSharp.XML - true - - - - 12 - - - - - - - - - FSharp.Core - FSharp.Core.dll - $(MSBuildExtensionsPath32)\..\Reference Assemblies\Microsoft\FSharp\.NETCore\$(TargetFSharpCoreVersion)\FSharp.Core.dll - - - Serilog - {0915dbd9-0f7c-4439-8d9e-74c3d579b219} - True - - - - \ No newline at end of file diff --git a/src/Serilog.Extras.FSharp/Serilog.Extras.FSharp.nuspec b/src/Serilog.Extras.FSharp/Serilog.Extras.FSharp.nuspec deleted file mode 100644 index 132dd31c0..000000000 --- a/src/Serilog.Extras.FSharp/Serilog.Extras.FSharp.nuspec +++ /dev/null @@ -1,22 +0,0 @@ - - - - Serilog.Extras.FSharp - $version$ - Serilog Contributors - Adds support for F# language constructs to Serilog. - en-US - http://serilog.net - http://www.apache.org/licenses/LICENSE-2.0 - http://serilog.net/images/serilog-nuget.png - serilog fsharp - - - - - - - - - - diff --git a/src/Serilog.Extras.FSharp/SerilogExtrasFSharp.fs b/src/Serilog.Extras.FSharp/SerilogExtrasFSharp.fs deleted file mode 100644 index 9970d3110..000000000 --- a/src/Serilog.Extras.FSharp/SerilogExtrasFSharp.fs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 Serilog Contributors -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -namespace Serilog.Extras.FSharp - -open Microsoft.FSharp.Reflection -open Serilog.Core -open Serilog.Events - -// Based on the sample from @vlaci in https://github.com/serilog/serilog/issues/352 - -type public UnionDestructuringPolicy() = - interface Serilog.Core.IDestructuringPolicy with - member this.TryDestructure(value, - propertyValueFactory : ILogEventPropertyValueFactory, - result: byref) = - if FSharpType.IsUnion(value.GetType()) then - let case, fields = FSharpValue.GetUnionFields(value, value.GetType()) - - let properties = Seq.zip (case.GetFields()) fields |> - Seq.map(fun (n, v) -> LogEventProperty( - n.Name, - propertyValueFactory.CreatePropertyValue(v, true))) - - result <- StructureValue(properties, case.Name) - true - else - false - -namespace Serilog - -open Serilog.Configuration -open Serilog.Extras.FSharp - -[] -module public LoggerDestructuringConfigurationExtensions = - type public LoggerDestructuringConfiguration with - member public this.FSharpTypes() = - this.With() - diff --git a/test/Serilog.Extras.DestructureByIgnoring.Tests/DestructureByIgnoringTests.cs b/test/Serilog.Extras.DestructureByIgnoring.Tests/DestructureByIgnoringTests.cs deleted file mode 100644 index 112be77b7..000000000 --- a/test/Serilog.Extras.DestructureByIgnoring.Tests/DestructureByIgnoringTests.cs +++ /dev/null @@ -1,88 +0,0 @@ -using System; -using System.Linq; -using System.Linq.Expressions; -using NUnit.Framework; -using Serilog.Events; -using Serilog.Tests.Support; - -namespace Serilog.Extras.DestructureByIgnoring.Tests -{ - [TestFixture] - public class DestructureByIgnoringTests - { - class DestructureMe - { - public int Id { get; set; } - public string Name { get; set; } - public string Password { get; set; } - } - - [Test] - public void PropertyNamesInExpressionsAreIgnoredWhenDestructuring() - { - LogEvent evt = null; - - Expression> valueTypeProperty = dm => dm.Id; - Expression> referenceTypeProperty = dm => dm.Password; - - var log = new LoggerConfiguration() - .Destructure.ByIgnoringProperties(valueTypeProperty, referenceTypeProperty) - .WriteTo.Sink(new DelegatingSink(e => evt = e)) - .CreateLogger(); - - var ignored = new DestructureMe - { - Id = 2, - Name = "Name", - Password = "Password" - }; - - log.Information("Here is {@Ignored}", ignored); - - var sv = (StructureValue)evt.Properties["Ignored"]; - var props = sv.Properties.ToDictionary(p => p.Name, p => p.Value); - - Assert.IsFalse(props.ContainsKey("Id"), "Id property should have been ignored"); - Assert.IsFalse(props.ContainsKey("Password"), "Password property should have been ignored."); - Assert.AreEqual("Name", props["Name"].LiteralValue()); - } - - [Test] - public void ComplexExpressionsFail() - { - AssertUnsupportedExpression(dm => new - { - Name = dm.Name - }); - } - - [Test] - public void MethodExpressionsFail() - { - AssertUnsupportedExpression(dm => dm.ToString()); - } - - [Test] - public void StringLiteralExpressionsFail() - { - AssertUnsupportedExpression(dm => "string literal"); - } - - [Test] - public void ChainedPropertyExpressionsFail() - { - AssertUnsupportedExpression(dm => dm.Password.Length); - } - - private void AssertUnsupportedExpression(Expression> expressionThatShouldFail) - { - var ex = Assert.Throws(() => - new LoggerConfiguration() - .Destructure - .ByIgnoringProperties(expressionThatShouldFail) - ); - - Assert.That(ex.ParamName, Is.EqualTo("ignoredProperty")); - } - } -} diff --git a/test/Serilog.Extras.DestructureByIgnoring.Tests/Properties/AssemblyInfo.cs b/test/Serilog.Extras.DestructureByIgnoring.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index bdc27c681..000000000 --- a/test/Serilog.Extras.DestructureByIgnoring.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Reflection; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Serilog.Extras.DestructureByIgnoring.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Serilog.Extras.DestructureByIgnoring.Tests")] -[assembly: AssemblyCopyright("Copyright © 2014")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("5fd4eb08-0ad6-4ce4-b403-113a97160559")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/test/Serilog.Extras.DestructureByIgnoring.Tests/Serilog.Extras.DestructureByIgnoring.Tests.csproj b/test/Serilog.Extras.DestructureByIgnoring.Tests/Serilog.Extras.DestructureByIgnoring.Tests.csproj deleted file mode 100644 index c38c46e0f..000000000 --- a/test/Serilog.Extras.DestructureByIgnoring.Tests/Serilog.Extras.DestructureByIgnoring.Tests.csproj +++ /dev/null @@ -1,79 +0,0 @@ - - - - - Debug - AnyCPU - {977E42C3-D501-4730-98FF-525B753B1E3A} - Library - Properties - Serilog.Extras.DestructureByIgnoring.Tests - Serilog.Extras.DestructureByIgnoring.Tests - v4.5 - 512 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - false - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - - - - ..\..\packages\NUnit.2.6.3\lib\nunit.framework.dll - - - - - - - - - - - - - - - - - - - {c5cc62f4-310f-495c-96ea-b8e5d26f8d57} - Serilog.Extras.DestructureByIgnoring - - - {0915dbd9-0f7c-4439-8d9e-74c3d579b219} - Serilog - - - {D5648551-D19D-41E3-9FC1-E74B111EEF41} - Serilog.Tests - - - - - - - - \ No newline at end of file diff --git a/test/Serilog.Extras.DestructureByIgnoring.Tests/packages.config b/test/Serilog.Extras.DestructureByIgnoring.Tests/packages.config deleted file mode 100644 index 967502dc8..000000000 --- a/test/Serilog.Extras.DestructureByIgnoring.Tests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file