diff --git a/AssemblyToProcess/AssemblyInfo.cs b/AssemblyToProcess/AssemblyInfo.cs
deleted file mode 100644
index e96b6f6..0000000
--- a/AssemblyToProcess/AssemblyInfo.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-
-using System.Reflection;
-
-[assembly: AssemblyVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/AssemblyToProcess/ClassWithObsoleteOnGetSet.cs b/AssemblyToProcess/ClassWithObsoleteOnGetSet.cs
index ab0b3d2..83e3af7 100644
--- a/AssemblyToProcess/ClassWithObsoleteOnGetSet.cs
+++ b/AssemblyToProcess/ClassWithObsoleteOnGetSet.cs
@@ -1,4 +1,4 @@
public class ClassWithObsoleteOnGetSet
{
- public string PropertyToMark { [ObsoleteEx]get; [ObsoleteEx]set; }
+ public string PropertyToMark { [ObsoleteEx] get; [ObsoleteEx] set; }
}
\ No newline at end of file
diff --git a/AssemblyToProcess/InterfaceToMark.cs b/AssemblyToProcess/InterfaceToMark.cs
index 0026b52..5d4ceff 100644
--- a/AssemblyToProcess/InterfaceToMark.cs
+++ b/AssemblyToProcess/InterfaceToMark.cs
@@ -1,14 +1,30 @@
using System;
-[ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")]
+[ObsoleteEx(
+ TreatAsErrorFromVersion = "2.0",
+ RemoveInVersion = "4.0",
+ Message = "Custom message.",
+ ReplacementTypeOrMember = "NewThing")]
public interface InterfaceToMark
{
- [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")]
+ [ObsoleteEx(
+ TreatAsErrorFromVersion = "2.0",
+ RemoveInVersion = "4.0",
+ Message = "Custom message.",
+ ReplacementTypeOrMember = "NewThing")]
string PropertyToMark { get; set; }
- [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")]
+ [ObsoleteEx(
+ TreatAsErrorFromVersion = "2.0",
+ RemoveInVersion = "4.0",
+ Message = "Custom message.",
+ ReplacementTypeOrMember = "NewThing")]
void MethodToMark();
- [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")]
+ [ObsoleteEx(
+ TreatAsErrorFromVersion = "2.0",
+ RemoveInVersion = "4.0",
+ Message = "Custom message.",
+ ReplacementTypeOrMember = "NewThing")]
event EventHandler EventToMark;
}
\ No newline at end of file
diff --git a/AssemblyToProcess/Sample.cs b/AssemblyToProcess/Sample.cs
index 63b58a9..a338310 100644
--- a/AssemblyToProcess/Sample.cs
+++ b/AssemblyToProcess/Sample.cs
@@ -2,7 +2,11 @@
namespace Before
{
- [ObsoleteEx(Message = "Custom message.", ReplacementTypeOrMember = "NewClass", TreatAsErrorFromVersion = "2.0", RemoveInVersion = "3.0")]
+ [ObsoleteEx(
+ Message = "Custom message.",
+ ReplacementTypeOrMember = "NewClass",
+ TreatAsErrorFromVersion = "2.0",
+ RemoveInVersion = "3.0")]
public class ClassToMark
{
}
diff --git a/AssemblyToProcess/StructToMark.cs b/AssemblyToProcess/StructToMark.cs
index 9aa2465..a8649ef 100644
--- a/AssemblyToProcess/StructToMark.cs
+++ b/AssemblyToProcess/StructToMark.cs
@@ -1,18 +1,38 @@
using System;
#pragma warning disable 67
-[ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")]
+[ObsoleteEx(
+ TreatAsErrorFromVersion = "2.0",
+ RemoveInVersion = "4.0",
+ Message = "Custom message.",
+ ReplacementTypeOrMember = "NewThing")]
public struct StructToMark
{
- [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")]
+ [ObsoleteEx(
+ TreatAsErrorFromVersion = "2.0",
+ RemoveInVersion = "4.0",
+ Message = "Custom message.",
+ ReplacementTypeOrMember = "NewThing")]
public string PropertyToMark { get; set; }
- [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")]
+ [ObsoleteEx(
+ TreatAsErrorFromVersion = "2.0",
+ RemoveInVersion = "4.0",
+ Message = "Custom message.",
+ ReplacementTypeOrMember = "NewThing")]
public string FieldToMark;
- [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")]
+ [ObsoleteEx(
+ TreatAsErrorFromVersion = "2.0",
+ RemoveInVersion = "4.0",
+ Message = "Custom message.",
+ ReplacementTypeOrMember = "NewThing")]
public void MethodToMark() { }
- [ObsoleteEx(TreatAsErrorFromVersion = "2.0", RemoveInVersion = "4.0", Message = "Custom message.", ReplacementTypeOrMember = "NewThing")]
+ [ObsoleteEx(
+ TreatAsErrorFromVersion = "2.0",
+ RemoveInVersion = "4.0",
+ Message = "Custom message.",
+ ReplacementTypeOrMember = "NewThing")]
public event EventHandler EventToMark;
}
\ No newline at end of file
diff --git a/CommonAssemblyInfo.cs b/CommonAssemblyInfo.cs
deleted file mode 100644
index 3f9503c..0000000
--- a/CommonAssemblyInfo.cs
+++ /dev/null
@@ -1,4 +0,0 @@
-using System.Reflection;
-[assembly: AssemblyTitle("Obsolete")]
-[assembly: AssemblyProduct("Obsolete")]
-[assembly: AssemblyVersion("4.3.4")]
\ No newline at end of file
diff --git a/Directory.Build.props b/Directory.Build.props
index bfc67ae..91c2469 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -2,6 +2,7 @@
true
- false
+ 4.3.5
+ latest
\ No newline at end of file
diff --git a/Obsolete.Fody/AttributeFixer.cs b/Obsolete.Fody/AttributeFixer.cs
index f674770..ed63787 100644
--- a/Obsolete.Fody/AttributeFixer.cs
+++ b/Obsolete.Fody/AttributeFixer.cs
@@ -29,12 +29,9 @@ void InnerProcess(IMemberDefinition memberDefinition)
LogError(error);
}
}
- else
+ else if (memberDefinition is PropertyDefinition propertyDefinition)
{
- if (memberDefinition is PropertyDefinition propertyDefinition)
- {
- throwsNotImplemented = ThrowsNotImplemented(propertyDefinition);
- }
+ throwsNotImplemented = ThrowsNotImplemented(propertyDefinition);
}
customAttributes.Remove(obsoleteExAttribute);
diff --git a/Obsolete.Fody/BrowsableAttributeAdder.cs b/Obsolete.Fody/BrowsableAttributeAdder.cs
index 5099ccf..0ff9664 100644
--- a/Obsolete.Fody/BrowsableAttributeAdder.cs
+++ b/Obsolete.Fody/BrowsableAttributeAdder.cs
@@ -10,8 +10,7 @@ public void AddEditorBrowsableAttribute(Collection customAttrib
{
return;
}
- var customAttribute = new CustomAttribute(EditorBrowsableConstructor);
- customAttribute.ConstructorArguments.Add(new CustomAttributeArgument(EditorBrowsableStateType, AdvancedStateConstant));
+ var customAttribute = new CustomAttribute(EditorBrowsableConstructor);
var customAttributeArgument = new CustomAttributeArgument(EditorBrowsableStateType, AdvancedStateConstant);
customAttribute.ConstructorArguments.Add(customAttributeArgument);
customAttributes.Add(customAttribute);
}
}
\ No newline at end of file
diff --git a/Obsolete.Fody/EditorBrowsableAttributeFinder.cs b/Obsolete.Fody/EditorBrowsableAttributeFinder.cs
index 853071b..e88461e 100644
--- a/Obsolete.Fody/EditorBrowsableAttributeFinder.cs
+++ b/Obsolete.Fody/EditorBrowsableAttributeFinder.cs
@@ -1,4 +1,3 @@
-using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
@@ -8,23 +7,15 @@ public partial class ModuleWeaver
public TypeDefinition EditorBrowsableStateType;
public int AdvancedStateConstant;
- void FindEditorBrowsableTypes(List typeDefinitions)
+ void FindEditorBrowsableTypes()
{
if (!HideObsoleteMembers)
{
return;
}
- var attributeType = typeDefinitions.FirstOrDefault(x => x.Name == "EditorBrowsableAttribute");
- if (attributeType == null)
- {
- throw new WeavingException("Could not find EditorBrowsableAttribute");
- }
+ var attributeType = FindType("System.ComponentModel.EditorBrowsableAttribute");
EditorBrowsableConstructor = ModuleDefinition.ImportReference(attributeType.Methods.First(IsDesiredConstructor));
- EditorBrowsableStateType = typeDefinitions.FirstOrDefault(x => x.Name == "EditorBrowsableState");
- if (EditorBrowsableStateType == null)
- {
- throw new WeavingException("Could not find EditorBrowsableAttribute");
- }
+ EditorBrowsableStateType = FindType("System.ComponentModel.EditorBrowsableState");
var fieldDefinition = EditorBrowsableStateType.Fields.First(x => x.Name == "Advanced");
AdvancedStateConstant = (int) fieldDefinition.Constant;
}
diff --git a/Obsolete.Fody/ModuleWeaver.cs b/Obsolete.Fody/ModuleWeaver.cs
index 9fca1bc..4c6f5a3 100644
--- a/Obsolete.Fody/ModuleWeaver.cs
+++ b/Obsolete.Fody/ModuleWeaver.cs
@@ -1,32 +1,15 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Xml.Linq;
-using Mono.Cecil;
+using System.Collections.Generic;
+using Fody;
-public partial class ModuleWeaver
+public partial class ModuleWeaver:BaseModuleWeaver
{
public SemanticVersion assemblyVersion;
- public Action LogInfo { get; set; }
- public Action LogWarning { get; set; }
- public Action LogError { get; set; }
- public ModuleDefinition ModuleDefinition { get; set; }
- public IAssemblyResolver AssemblyResolver { get; set; }
- public XElement Config { get; set; }
- public ModuleWeaver()
- {
- LogInfo = s => { };
- LogWarning = s => { };
- LogError = s => { };
- }
-
- public void Execute()
+ public override void Execute()
{
ReadConfig();
- var systemTypes = FindSystemTypes();
- FindEditorBrowsableTypes(systemTypes);
- FindObsoleteType(systemTypes);
+ FindEditorBrowsableTypes();
+ FindObsoleteType();
var version = ModuleDefinition.Assembly.Name.Version;
assemblyVersion = new SemanticVersion
@@ -37,38 +20,15 @@ public void Execute()
};
ProcessAssembly();
-
- CleanReferences();
}
- public List FindSystemTypes()
+ public override IEnumerable GetAssembliesForScanning()
{
- var types = new List();
-
- AddAssemblyIfExists("mscorlib", types);
- AddAssemblyIfExists("System", types);
- AddAssemblyIfExists("System.Runtime", types);
- AddAssemblyIfExists("netstandard", types);
-
- return types;
+ yield return "mscorlib";
+ yield return "System";
+ yield return "System.Runtime";
+ yield return "netstandard";
}
- void AddAssemblyIfExists(string name, List types)
- {
- try
- {
- var msCoreLibDefinition = AssemblyResolver.Resolve(new AssemblyNameReference(name, null));
-
- if (msCoreLibDefinition != null)
- {
- var module = msCoreLibDefinition.MainModule;
- types.AddRange(module.Types);
- types.AddRange(module.ExportedTypes.Select(x => x.Resolve()).Where(x => x != null));
- }
- }
- catch (AssemblyResolutionException)
- {
- LogInfo($"Failed to resolve '{name}'. So skipping its types.");
- }
- }
+ public override bool ShouldCleanReference => true;
}
\ No newline at end of file
diff --git a/Obsolete.Fody/Obsolete.Fody.csproj b/Obsolete.Fody/Obsolete.Fody.csproj
index 9a6c7b2..8b26408 100644
--- a/Obsolete.Fody/Obsolete.Fody.csproj
+++ b/Obsolete.Fody/Obsolete.Fody.csproj
@@ -1,27 +1,13 @@
- net452;netcoreapp2.0
+ net46;netstandard2.0
+ portable
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Obsolete.Fody/Obsolete.Fody.nuspec b/Obsolete.Fody/Obsolete.Fody.nuspec
deleted file mode 100644
index 5a32eae..0000000
--- a/Obsolete.Fody/Obsolete.Fody.nuspec
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
- Obsolete.Fody
- $version$
- Obsolete.Fody
- Simon Cropp
- Simon Cropp
- true
- http://www.opensource.org/licenses/mit-license.php
- http://github.com/Fody/Obsolete
- false
- https://raw.github.com/Fody/Obsolete/master/package_icon.png
- Allows a more expressive use of the ObsoleteAttribute.
- en-AU
- Obsolete, ObsoleteAttribute, ILWeaving, Fody, Cecil
-
-
-
-
-
\ No newline at end of file
diff --git a/Obsolete.Fody/ObsoleteTypeFinder.cs b/Obsolete.Fody/ObsoleteTypeFinder.cs
index ee3d3df..c70611c 100644
--- a/Obsolete.Fody/ObsoleteTypeFinder.cs
+++ b/Obsolete.Fody/ObsoleteTypeFinder.cs
@@ -1,4 +1,3 @@
-using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
@@ -6,14 +5,9 @@ public partial class ModuleWeaver
{
public MethodReference ObsoleteConstructorReference;
- public void FindObsoleteType(List systemTypes)
+ public void FindObsoleteType()
{
- var obsoleteDefinition = systemTypes
- .FirstOrDefault(x => x.Name == "ObsoleteAttribute");
- if (obsoleteDefinition == null)
- {
- throw new WeavingException("Could not find ObsoleteAttribute");
- }
+ var obsoleteDefinition = FindType("System.ObsoleteAttribute");
var constructor = obsoleteDefinition.Methods.First(x =>
x.Parameters.Count == 2
&& x.Parameters[0].ParameterType.Name == "String"
diff --git a/Obsolete.Fody/ReferenceCleaner.cs b/Obsolete.Fody/ReferenceCleaner.cs
deleted file mode 100644
index af03450..0000000
--- a/Obsolete.Fody/ReferenceCleaner.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.Linq;
-
-public partial class ModuleWeaver
-{
- public void CleanReferences()
- {
- var referenceToRemove = ModuleDefinition.AssemblyReferences.FirstOrDefault(x => x.Name == "Obsolete");
- if (referenceToRemove == null)
- {
- LogInfo("\tNo reference to 'Obsolete.dll' found. References not modified.");
- return;
- }
-
- ModuleDefinition.AssemblyReferences.Remove(referenceToRemove);
- LogInfo("\tRemoving reference to 'Obsolete.dll'.");
- }
-}
\ No newline at end of file
diff --git a/Obsolete.Fody/WeavingException.cs b/Obsolete.Fody/WeavingException.cs
index a15a1aa..67e48c8 100644
--- a/Obsolete.Fody/WeavingException.cs
+++ b/Obsolete.Fody/WeavingException.cs
@@ -5,6 +5,5 @@ public class WeavingException : Exception
public WeavingException(string message)
: base(message)
{
-
}
}
\ No newline at end of file
diff --git a/Obsolete.Fody/packages.config b/Obsolete.Fody/packages.config
deleted file mode 100644
index bc89e2d..0000000
--- a/Obsolete.Fody/packages.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/Obsolete.sln b/Obsolete.sln
index 44c18fb..f50af00 100644
--- a/Obsolete.sln
+++ b/Obsolete.sln
@@ -1,20 +1,19 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
-VisualStudioVersion = 15.0.27004.2009
+VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 14.0.22823.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Obsolete.Fody", "Obsolete.Fody\Obsolete.Fody.csproj", "{C3578A7B-09A6-4444-9383-0DEAFA4958BD}"
- ProjectSection(ProjectDependencies) = postProject
- {5D6191BF-F0EE-474D-B168-BB92418A0F3D} = {5D6191BF-F0EE-474D-B168-BB92418A0F3D}
- EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AssemblyToProcess", "AssemblyToProcess\AssemblyToProcess.csproj", "{40939411-32F0-48DD-B17B-FA46DD5D9B25}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Obsolete", "Obsolete\Obsolete.csproj", "{5D6191BF-F0EE-474D-B168-BB92418A0F3D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tests", "Tests\Tests.csproj", "{DAB36D28-050A-4F2A-AA93-B3163F92D71A}"
- ProjectSection(ProjectDependencies) = postProject
- {40939411-32F0-48DD-B17B-FA46DD5D9B25} = {40939411-32F0-48DD-B17B-FA46DD5D9B25}
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{542159B5-0A1C-4A9E-9F8B-419440F21481}"
+ ProjectSection(SolutionItems) = preProject
+ Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject
Global
diff --git a/Obsolete.sln.DotSettings b/Obsolete.sln.DotSettings
index 1013fe6..ec41b8e 100644
--- a/Obsolete.sln.DotSettings
+++ b/Obsolete.sln.DotSettings
@@ -594,11 +594,13 @@ II.2.12 <HandlesEvent />
<Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
True
True
+ True
True
True
True
True
True
+ True
True
True
True
diff --git a/Obsolete/Obsolete.csproj b/Obsolete/Obsolete.csproj
index 0da1456..bdcf30b 100644
--- a/Obsolete/Obsolete.csproj
+++ b/Obsolete/Obsolete.csproj
@@ -1,13 +1,16 @@
- net452;netstandard1.4
+ net452;netstandard1.0
true
- ..\key.snk
+ key.snk
true
+ Allows a more expressive use of the ObsoleteAttribute.
+ Obsolete, ObsoleteAttribute, ILWeaving, Fody, Cecil
+
+
-
\ No newline at end of file
diff --git a/Obsolete/ObsoleteExAttribute.cs b/Obsolete/ObsoleteExAttribute.cs
index 908f55e..edf48e1 100644
--- a/Obsolete/ObsoleteExAttribute.cs
+++ b/Obsolete/ObsoleteExAttribute.cs
@@ -44,5 +44,4 @@ public sealed class ObsoleteExAttribute : Attribute
/// A value pointing to the name of the replacement member if available.
///
public string ReplacementTypeOrMember { get; set; }
-
}
\ No newline at end of file
diff --git a/key.snk b/Obsolete/key.snk
similarity index 100%
rename from key.snk
rename to Obsolete/key.snk
diff --git a/Packages/repositories.config b/Packages/repositories.config
deleted file mode 100644
index 4dbee78..0000000
--- a/Packages/repositories.config
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/README.md b/README.md
index 13ec0a9..0e28592 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,5 @@
-[![Chat on Gitter](https://img.shields.io/gitter/room/fody/fody.svg?style=flat)](https://gitter.im/Fody/Fody)
-[![NuGet Status](http://img.shields.io/nuget/v/Obsolete.Fody.svg?style=flat)](https://www.nuget.org/packages/Obsolete.Fody/)
+[![Chat on Gitter](https://img.shields.io/gitter/room/fody/fody.svg?style=flat&max-age=86400)](https://gitter.im/Fody/Fody)
+[![NuGet Status](http://img.shields.io/nuget/v/Obsolete.Fody.svg?style=flat&max-age=86400)](https://www.nuget.org/packages/Obsolete.Fody/)
## This is an add-in for [Fody](https://github.com/Fody/Fody/)
diff --git a/Tests/AttributeDataFormatterTests.cs b/Tests/AttributeDataFormatterTests.cs
index 483ffb8..c14af6a 100644
--- a/Tests/AttributeDataFormatterTests.cs
+++ b/Tests/AttributeDataFormatterTests.cs
@@ -1,11 +1,9 @@
using System.Diagnostics;
-using NUnit.Framework;
+using Xunit;
-[TestFixture]
public class AttributeDataFormatterTests
{
-
- [Test]
+ [Fact]
public void All()
{
var attributeData = new AttributeData
@@ -18,11 +16,10 @@ public void All()
SemanticVersion assemblyVersion = "1";
var dataFormatter = new ModuleWeaver {assemblyVersion = assemblyVersion};
var message = dataFormatter.ConvertToMessage(attributeData);
- Assert.AreEqual("Custom Message. Use `NewMember` instead. Will be treated as an error from version 2.0.0. Will be removed in version 4.0.0.", message);
+ Assert.Equal("Custom Message. Use `NewMember` instead. Will be treated as an error from version 2.0.0. Will be removed in version 4.0.0.", message);
}
-
- [Test]
+ [Fact]
public void ForSample()
{
var attributeData = new AttributeData
@@ -33,10 +30,8 @@ public void ForSample()
Replacement = "NewClass"
};
var dataFormatter1 = new ModuleWeaver { assemblyVersion = "1"};
- Debug.WriteLine(dataFormatter1.ConvertToMessage(attributeData));
+ Trace.WriteLine(dataFormatter1.ConvertToMessage(attributeData));
var dataFormatter2 = new ModuleWeaver { assemblyVersion = "3"};
- Debug.WriteLine(dataFormatter2.ConvertToMessage(attributeData));
+ Trace.WriteLine(dataFormatter2.ConvertToMessage(attributeData));
}
-
-
}
\ No newline at end of file
diff --git a/Tests/ConfigReaderTests.cs b/Tests/ConfigReaderTests.cs
index f471052..8ec3612 100644
--- a/Tests/ConfigReaderTests.cs
+++ b/Tests/ConfigReaderTests.cs
@@ -1,63 +1,77 @@
using System.Xml.Linq;
-using NUnit.Framework;
+using Xunit;
-[TestFixture]
public class ConfigReaderTests
{
-
- [Test]
+ [Fact]
public void TrueHideObsoleteMembers()
{
var xElement = XElement.Parse(@"");
- var moduleWeaver = new ModuleWeaver {Config = xElement};
+ var moduleWeaver = new ModuleWeaver
+ {
+ Config = xElement
+ };
moduleWeaver.ReadConfig();
- Assert.IsTrue(moduleWeaver.HideObsoleteMembers);
+ Assert.True(moduleWeaver.HideObsoleteMembers);
}
- [Test]
+ [Fact]
public void ThrowsNotImplementedText()
{
var xElement = XElement.Parse(@"");
- var moduleWeaver = new ModuleWeaver {Config = xElement};
+ var moduleWeaver = new ModuleWeaver
+ {
+ Config = xElement
+ };
moduleWeaver.ReadConfig();
- Assert.AreEqual("Custom Text", moduleWeaver.ThrowsNotImplementedText);
+ Assert.Equal("Custom Text", moduleWeaver.ThrowsNotImplementedText);
}
- [Test]
+ [Fact]
public void FalseHideObsoleteMembers()
{
var xElement = XElement.Parse(@"");
- var moduleWeaver = new ModuleWeaver {Config = xElement};
+ var moduleWeaver = new ModuleWeaver
+ {
+ Config = xElement
+ };
moduleWeaver.ReadConfig();
- Assert.IsFalse(moduleWeaver.HideObsoleteMembers);
+ Assert.False(moduleWeaver.HideObsoleteMembers);
}
- [Test]
+ [Fact]
public void EmptyHideObsoleteMembers()
{
var xElement = XElement.Parse("");
- var moduleWeaver = new ModuleWeaver {Config = xElement};
+ var moduleWeaver = new ModuleWeaver
+ {
+ Config = xElement
+ };
moduleWeaver.ReadConfig();
- Assert.IsTrue(moduleWeaver.HideObsoleteMembers);
+ Assert.True(moduleWeaver.HideObsoleteMembers);
}
- [Test]
+ [Fact]
public void CanParseStepType()
{
var xElement = XElement.Parse(@"");
- var moduleWeaver = new ModuleWeaver {Config = xElement};
+ var moduleWeaver = new ModuleWeaver
+ {
+ Config = xElement
+ };
moduleWeaver.ReadConfig();
- Assert.AreEqual(StepType.Minor, moduleWeaver.StepType);
+ Assert.Equal(StepType.Minor, moduleWeaver.StepType);
}
- [Test]
+ [Fact]
public void VersionIncrementThrows()
{
var xElement = XElement.Parse(@"");
- var moduleWeaver = new ModuleWeaver {Config = xElement};
- var exception = Assert.Throws(moduleWeaver.ReadConfig);
- Assert.AreEqual("VersionIncrement is no longer supported. Use StepType instead.", exception.Message);
+ var moduleWeaver = new ModuleWeaver
+ {
+ Config = xElement
+ };
+ var exception = Assert.Throws(() => moduleWeaver.ReadConfig());
+ Assert.Equal("VersionIncrement is no longer supported. Use StepType instead.", exception.Message);
}
-
-
}
\ No newline at end of file
diff --git a/Tests/IntegrationTests.cs b/Tests/IntegrationTests.cs
index 22028de..0f156d6 100644
--- a/Tests/IntegrationTests.cs
+++ b/Tests/IntegrationTests.cs
@@ -1,48 +1,28 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel;
-using System.IO;
using System.Linq;
using System.Reflection;
-using Mono.Cecil;
-using NUnit.Framework;
+using Fody;
+using Xunit;
using ICustomAttributeProvider = System.Reflection.ICustomAttributeProvider;
+#pragma warning disable 618
-[TestFixture]
public class IntegrationTests
{
- Assembly assembly;
- List warnings = new List();
- List errors = new List();
- string beforeAssemblyPath;
- string afterAssemblyPath;
+ static Assembly assembly;
+ static TestResult testResult;
- public IntegrationTests()
+ static IntegrationTests()
{
- beforeAssemblyPath = Path.Combine(TestContext.CurrentContext.TestDirectory, "AssemblyToProcess.dll");
-
- afterAssemblyPath = beforeAssemblyPath.Replace(".dll", "2.dll");
- File.Copy(beforeAssemblyPath, afterAssemblyPath, true);
-
- using (var moduleDefinition = ModuleDefinition.ReadModule(beforeAssemblyPath))
+ var weavingTask = new ModuleWeaver
{
- var weavingTask = new ModuleWeaver
- {
- ModuleDefinition = moduleDefinition,
- AssemblyResolver = new DefaultAssemblyResolver(),
- LogWarning = s => warnings.Add(s),
- LogError = s => errors.Add(s),
- HideObsoleteMembers = true
- };
-
- weavingTask.Execute();
- moduleDefinition.Write(afterAssemblyPath);
- }
-
- assembly = Assembly.LoadFile(afterAssemblyPath);
+ HideObsoleteMembers = true
+ };
+ testResult = weavingTask.ExecuteTestRun("AssemblyToProcess.dll");
+ assembly = testResult.Assembly;
}
- [Test]
+ [Fact]
public void Class()
{
var type = assembly.GetType("ClassToMark");
@@ -50,76 +30,76 @@ public void Class()
ValidateIsNotError(type);
}
- [Test]
+ [Fact]
public void ClassWithHigherAssumedRemoveInVersion()
{
var type = assembly.GetType("ClassToMarkWithHigherAssumedRemoveInVersion");
- var customAttributes = ((ICustomAttributeProvider) type).GetCustomAttributes(typeof(ObsoleteAttribute), false);
- var obsoleteAttribute = (ObsoleteAttribute) customAttributes.First();
- Assert.AreEqual("Will be treated as an error from version 3.0.0. Will be removed in version 4.0.0.", obsoleteAttribute.Message);
+ var customAttributes = ((ICustomAttributeProvider)type).GetCustomAttributes(typeof(ObsoleteAttribute), false);
+ var obsoleteAttribute = (ObsoleteAttribute)customAttributes.First();
+ Assert.Equal("Will be treated as an error from version 3.0.0. Will be removed in version 4.0.0.", obsoleteAttribute.Message);
ValidateIsNotError(type);
}
- [Test]
+ [Fact]
public void ClassToMarkWithSameRemoveAndTreatAsError()
{
var type = assembly.GetType("ClassToMarkWithSameRemoveAndTreatAsError");
- var customAttributes = ((ICustomAttributeProvider) type).GetCustomAttributes(typeof(ObsoleteAttribute), false);
- var obsoleteAttribute = (ObsoleteAttribute) customAttributes.First();
- Assert.AreEqual("Will be treated as an error from version 1.2.0. Will be removed in version 1.2.0.", obsoleteAttribute.Message);
+ var customAttributes = ((ICustomAttributeProvider)type).GetCustomAttributes(typeof(ObsoleteAttribute), false);
+ var obsoleteAttribute = (ObsoleteAttribute)customAttributes.First();
+ Assert.Equal("Will be treated as an error from version 1.2.0. Will be removed in version 1.2.0.", obsoleteAttribute.Message);
ValidateIsNotError(type);
}
- [Test]
+ [Fact]
public void ClassToMarkWithHigherAssumedTreatAsErrorFromVersion()
{
var type = assembly.GetType("ClassToMarkWithHigherAssumedTreatAsErrorFromVersion");
- var customAttributes = ((ICustomAttributeProvider) type).GetCustomAttributes(typeof(ObsoleteAttribute), false);
- var obsoleteAttribute = (ObsoleteAttribute) customAttributes.First();
- Assert.AreEqual("Will be treated as an error from version 2.0.0. Will be removed in version 3.0.0.", obsoleteAttribute.Message);
+ var customAttributes = ((ICustomAttributeProvider)type).GetCustomAttributes(typeof(ObsoleteAttribute), false);
+ var obsoleteAttribute = (ObsoleteAttribute)customAttributes.First();
+ Assert.Equal("Will be treated as an error from version 2.0.0. Will be removed in version 3.0.0.", obsoleteAttribute.Message);
ValidateIsNotError(type);
}
- [Test]
+ [Fact]
public void ClassWithAssumedRemoveInVersion()
{
var type = assembly.GetType("ClassToMarkWithAssumedRemoveInVersion");
- var customAttributes = ((ICustomAttributeProvider) type).GetCustomAttributes(typeof(ObsoleteAttribute), false);
- var obsoleteAttribute = (ObsoleteAttribute) customAttributes.First();
- Assert.AreEqual("Will be treated as an error from version 2.0.0. Will be removed in version 3.0.0.", obsoleteAttribute.Message);
+ var customAttributes = ((ICustomAttributeProvider)type).GetCustomAttributes(typeof(ObsoleteAttribute), false);
+ var obsoleteAttribute = (ObsoleteAttribute)customAttributes.First();
+ Assert.Equal("Will be treated as an error from version 2.0.0. Will be removed in version 3.0.0.", obsoleteAttribute.Message);
ValidateIsNotError(type);
}
- [Test]
+ [Fact]
public void ClassToMarkWithAssumedTreatAsErrorFromVersion()
{
var type = assembly.GetType("ClassToMarkWithAssumedTreatAsErrorFromVersion");
- var customAttributes = ((ICustomAttributeProvider) type).GetCustomAttributes(typeof(ObsoleteAttribute), false);
- var obsoleteAttribute = (ObsoleteAttribute) customAttributes.First();
- Assert.AreEqual("Will be removed in version 2.0.0.", obsoleteAttribute.Message);
+ var customAttributes = ((ICustomAttributeProvider)type).GetCustomAttributes(typeof(ObsoleteAttribute), false);
+ var obsoleteAttribute = (ObsoleteAttribute)customAttributes.First();
+ Assert.Equal("Will be removed in version 2.0.0.", obsoleteAttribute.Message);
ValidateIsError(type);
}
- [Test]
+ [Fact]
public void Warnings()
{
- Assert.Contains("The member `ClassWithObsoleteAttribute` has an ObsoleteAttribute. Consider replacing it with an ObsoleteExAttribute.", warnings);
+ Assert.Contains("The member `ClassWithObsoleteAttribute` has an ObsoleteAttribute. Consider replacing it with an ObsoleteExAttribute.", testResult.Warnings.Select(x => x.Text));
}
- [Test]
+ [Fact]
public void NoWarnings()
{
- Assert.That(warnings, Does.Not.Contains("The member `ClassWithObsoleteAttributeToSkip` has an ObsoleteAttribute. Consider replacing it with an ObsoleteExAttribute."));
+ Assert.DoesNotContain("The member `ClassWithObsoleteAttributeToSkip` has an ObsoleteAttribute. Consider replacing it with an ObsoleteExAttribute.", testResult.Warnings.Select(x => x.Text));
}
- [Test]
+ [Fact]
public void Errors()
{
- Assert.Contains("ObsoleteExAttribute is not valid on property gets or sets. Member: `System.Void ClassWithObsoleteOnGetSet::set_PropertyToMark(System.String)`.", errors);
- Assert.Contains("ObsoleteExAttribute is not valid on property gets or sets. Member: `System.String ClassWithObsoleteOnGetSet::get_PropertyToMark()`.", errors);
+ Assert.Contains("ObsoleteExAttribute is not valid on property gets or sets. Member: `System.Void ClassWithObsoleteOnGetSet::set_PropertyToMark(System.String)`.", testResult.Errors.Select(x => x.Text));
+ Assert.Contains("ObsoleteExAttribute is not valid on property gets or sets. Member: `System.String ClassWithObsoleteOnGetSet::get_PropertyToMark()`.", testResult.Errors.Select(x => x.Text));
}
- [Test]
+ [Fact]
public void Interface()
{
var type = assembly.GetType("InterfaceToMark");
@@ -128,28 +108,28 @@ public void Interface()
ValidateIsNotError(type);
}
- [Test]
+ [Fact]
public void ClassWithIsError()
{
var type = assembly.GetType("ClassWithIsError");
ValidateIsError(type);
}
- [Test]
+ [Fact]
public void Enum()
{
var type = assembly.GetType("EnumToMark");
ValidateIsNotError(type);
}
- [Test]
+ [Fact]
public void Struct()
{
var type = assembly.GetType("StructToMark");
ValidateIsNotError(type);
}
- [Test]
+ [Fact]
public void EnumField()
{
var type = assembly.GetType("EnumToMark");
@@ -159,7 +139,7 @@ public void EnumField()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void ClassMethod()
{
var type = assembly.GetType("ClassToMark");
@@ -169,18 +149,18 @@ public void ClassMethod()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void ClassMethodThatThrows()
{
var type = assembly.GetType("ClassToMark");
var info = type.GetMethod("MethodWithExceptionToMark");
var obsoleteAttribute = ReadAttribute(info);
- Assert.AreEqual("Custom message. Use `NewThing` instead. Will be treated as an error from version 2.0.0. The member currently throws a NotImplementedException. Will be removed in version 4.0.0.", obsoleteAttribute.Message);
+ Assert.Equal("Custom message. Use `NewThing` instead. Will be treated as an error from version 2.0.0. The member currently throws a NotImplementedException. Will be removed in version 4.0.0.", obsoleteAttribute.Message);
ValidateHidden(info);
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void InterfaceMethod()
{
var type = assembly.GetType("InterfaceToMark");
@@ -190,7 +170,7 @@ public void InterfaceMethod()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void StructMethod()
{
var type = assembly.GetType("StructToMark");
@@ -200,29 +180,29 @@ public void StructMethod()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void ClassPropertySetThatThrows()
{
var type = assembly.GetType("ClassToMark");
var info = type.GetProperty("PropertyWithSetExceptionToMark");
var obsoleteAttribute = ReadAttribute(info);
- Assert.AreEqual("Custom message. Use `NewThing` instead. Will be treated as an error from version 2.0.0. The member currently throws a NotImplementedException. Will be removed in version 4.0.0.", obsoleteAttribute.Message);
+ Assert.Equal("Custom message. Use `NewThing` instead. Will be treated as an error from version 2.0.0. The member currently throws a NotImplementedException. Will be removed in version 4.0.0.", obsoleteAttribute.Message);
ValidateHidden(info);
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void ClassPropertyGetThatThrows()
{
var type = assembly.GetType("ClassToMark");
var info = type.GetProperty("PropertyWithGetExceptionToMark");
var obsoleteAttribute = ReadAttribute(info);
- Assert.AreEqual("Custom message. Use `NewThing` instead. Will be treated as an error from version 2.0.0. The member currently throws a NotImplementedException. Will be removed in version 4.0.0.", obsoleteAttribute.Message);
+ Assert.Equal("Custom message. Use `NewThing` instead. Will be treated as an error from version 2.0.0. The member currently throws a NotImplementedException. Will be removed in version 4.0.0.", obsoleteAttribute.Message);
ValidateHidden(info);
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void ClassProperty()
{
var type = assembly.GetType("ClassToMark");
@@ -232,7 +212,7 @@ public void ClassProperty()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void ClassField()
{
var type = assembly.GetType("ClassToMark");
@@ -242,7 +222,7 @@ public void ClassField()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void InterfaceEvent()
{
var type = assembly.GetType("InterfaceToMark");
@@ -252,7 +232,7 @@ public void InterfaceEvent()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void ClassEvent()
{
var type = assembly.GetType("ClassToMark");
@@ -262,7 +242,7 @@ public void ClassEvent()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void StructEvent()
{
var type = assembly.GetType("StructToMark");
@@ -272,7 +252,7 @@ public void StructEvent()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void InterfaceProperty()
{
var type = assembly.GetType("InterfaceToMark");
@@ -282,7 +262,7 @@ public void InterfaceProperty()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void StructProperty()
{
var type = assembly.GetType("StructToMark");
@@ -292,7 +272,7 @@ public void StructProperty()
ValidateIsNotError(info);
}
- [Test]
+ [Fact]
public void StructField()
{
var type = assembly.GetType("StructToMark");
@@ -305,41 +285,31 @@ public void StructField()
static void ValidateMessage(ICustomAttributeProvider attributeProvider)
{
var obsoleteAttribute = ReadAttribute(attributeProvider);
- Assert.AreEqual("Custom message. Use `NewThing` instead. Will be treated as an error from version 2.0.0. Will be removed in version 4.0.0.", obsoleteAttribute.Message);
+ Assert.Equal("Custom message. Use `NewThing` instead. Will be treated as an error from version 2.0.0. Will be removed in version 4.0.0.", obsoleteAttribute.Message);
}
static ObsoleteAttribute ReadAttribute(ICustomAttributeProvider attributeProvider)
{
var customAttributes = attributeProvider.GetCustomAttributes(typeof(ObsoleteAttribute), false);
- return (ObsoleteAttribute) customAttributes.First();
+ return (ObsoleteAttribute)customAttributes.First();
}
static void ValidateHidden(ICustomAttributeProvider attributeProvider)
{
var customAttributes = attributeProvider.GetCustomAttributes(typeof(EditorBrowsableAttribute), false);
- var attribute = (EditorBrowsableAttribute) customAttributes.First();
- Assert.AreEqual(EditorBrowsableState.Advanced, attribute.State);
+ var attribute = (EditorBrowsableAttribute)customAttributes.First();
+ Assert.Equal(EditorBrowsableState.Advanced, attribute.State);
}
static void ValidateIsError(ICustomAttributeProvider attributeProvider)
{
var obsoleteAttribute = ReadAttribute(attributeProvider);
- Assert.IsTrue(obsoleteAttribute.IsError);
+ Assert.True(obsoleteAttribute.IsError);
}
static void ValidateIsNotError(ICustomAttributeProvider attributeProvider)
{
var obsoleteAttribute = ReadAttribute(attributeProvider);
- Assert.IsFalse(obsoleteAttribute.IsError);
+ Assert.False(obsoleteAttribute.IsError);
}
-
-
-#if(DEBUG)
- [Test]
- public void PeVerify()
- {
- Verifier.Verify(beforeAssemblyPath, afterAssemblyPath);
- }
-#endif
-
}
\ No newline at end of file
diff --git a/Tests/SemanticVersionTests.cs b/Tests/SemanticVersionTests.cs
index 5643c21..b746ea9 100644
--- a/Tests/SemanticVersionTests.cs
+++ b/Tests/SemanticVersionTests.cs
@@ -1,21 +1,20 @@
-using NUnit.Framework;
+using Xunit;
-[TestFixture]
public class SemanticVersionTests
{
- [Test]
+ [Fact]
public void TryParse()
{
SemanticVersion.TryParse("0.1", out var version1);
- Assert.AreEqual(version1.Major,0);
- Assert.AreEqual(version1.Minor,1);
- Assert.AreEqual(version1.Patch,0);
+ Assert.Equal(0, version1.Major);
+ Assert.Equal(1, version1.Minor);
+ Assert.Equal(0, version1.Patch);
SemanticVersion.TryParse("0.1.0", out var version2);
- Assert.AreEqual(version2.Major,0);
- Assert.AreEqual(version2.Minor,1);
- Assert.AreEqual(version2.Patch,0);
+ Assert.Equal(0, version2.Major);
+ Assert.Equal(1, version2.Minor);
+ Assert.Equal(0, version2.Patch);
}
}
\ No newline at end of file
diff --git a/Tests/Tests.csproj b/Tests/Tests.csproj
index 18baa51..2a0a90a 100644
--- a/Tests/Tests.csproj
+++ b/Tests/Tests.csproj
@@ -1,15 +1,14 @@
- net452;netcoreapp2.0
+ net46;netcoreapp2.0
true
-
-
-
-
+
+
+
diff --git a/Tests/Verifier.cs b/Tests/Verifier.cs
deleted file mode 100644
index 6ec180a..0000000
--- a/Tests/Verifier.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text.RegularExpressions;
-using NUnit.Framework;
-
-public static class Verifier
-{
- static string exePath;
-
- static Verifier()
- {
- var windowsSdk = Environment.ExpandEnvironmentVariables(@"%programfiles(x86)%\Microsoft SDKs\Windows\");
- exePath = Directory.EnumerateFiles(windowsSdk, "PEVerify.exe", SearchOption.AllDirectories)
- .OrderByDescending(x =>
- {
- var fileVersionInfo = FileVersionInfo.GetVersionInfo(x);
- return new Version(fileVersionInfo.FileMajorPart, fileVersionInfo.FileMinorPart, fileVersionInfo.FileBuildPart);
- })
- .FirstOrDefault();
- if (exePath == null)
- {
- throw new Exception("Could not find path to PEVerify");
- }
- }
-
- public static void Verify(string beforeAssemblyPath, string afterAssemblyPath)
- {
- var before = Validate(beforeAssemblyPath);
- var after = Validate(afterAssemblyPath);
- var message = $"Failed processing {Path.GetFileName(afterAssemblyPath)}\r\n{after}";
- Assert.AreEqual(TrimLineNumbers(before), TrimLineNumbers(after), message);
- }
-
- static string Validate(string assemblyPath2)
- {
- using (var process = Process.Start(new ProcessStartInfo(exePath, $"\"{assemblyPath2}\"")
- {
- RedirectStandardOutput = true,
- UseShellExecute = false,
- CreateNoWindow = true
- }))
- {
- process.WaitForExit(10000);
- return process.StandardOutput.ReadToEnd().Trim().Replace(assemblyPath2, "");
- }
- }
-
- static string TrimLineNumbers(string foo)
- {
- return Regex.Replace(foo, "0x.*]", "");
- }
-}
\ No newline at end of file
diff --git a/Tests/VersionExtensionTests.cs b/Tests/VersionExtensionTests.cs
index 45823cb..748534d 100644
--- a/Tests/VersionExtensionTests.cs
+++ b/Tests/VersionExtensionTests.cs
@@ -1,128 +1,126 @@
-using NUnit.Framework;
+using Xunit;
-[TestFixture]
public class VersionExtensionTests
{
-
- [Test]
+ [Fact]
public void IncrementMajor()
{
SemanticVersion version1 = "2";
var version = version1.Increment(StepType.Major);
- Assert.AreEqual("3.0.0",(string)version);
+ Assert.Equal("3.0.0",version);
}
- [Test]
+ [Fact]
public void IncrementMajorWithMinor()
{
SemanticVersion version1 = "2.1";
var version = version1.Increment(StepType.Major);
- Assert.AreEqual("3.0.0",(string)version);
+ Assert.Equal("3.0.0",version);
}
- [Test]
+ [Fact]
public void IncrementMajorWithMinorAndPatch()
{
SemanticVersion version1 = "2.1.1";
var version = version1.Increment(StepType.Major);
- Assert.AreEqual("3.0.0",(string)version);
+ Assert.Equal("3.0.0",version);
}
- [Test]
+ [Fact]
public void IncrementMinor()
{
SemanticVersion version1 = "2";
var version = version1.Increment(StepType.Minor);
- Assert.AreEqual("2.1.0",(string)version);
+ Assert.Equal("2.1.0",version);
}
- [Test]
+ [Fact]
public void IncrementMinorWithPatch()
{
SemanticVersion version1 = "2.0.1";
var version = version1.Increment(StepType.Minor);
- Assert.AreEqual("2.1.0",(string)version);
+ Assert.Equal("2.1.0",version);
}
- [Test]
+ [Fact]
public void IncrementPatch()
{
SemanticVersion version1 = "2";
var version = version1.Increment(StepType.Patch);
- Assert.AreEqual("2.0.1",(string)version);
+ Assert.Equal("2.0.1",version);
}
- [Test]
+ [Fact]
public void IncrementPatchWithMinor()
{
SemanticVersion version1 = "2.1";
var version = version1.Increment(StepType.Patch);
- Assert.AreEqual("2.1.1",(string)version);
+ Assert.Equal("2.1.1",version);
}
- [Test]
+ [Fact]
public void DecrementMajor()
{
SemanticVersion version1 = "2";
var version = version1.Decrement(StepType.Major);
- Assert.AreEqual("1.0.0", (string)version);
+ Assert.Equal("1.0.0", version);
}
- [Test]
+ [Fact]
public void DecrementMajorWithMinor()
{
SemanticVersion version1 = "2.1";
var version = version1.Decrement(StepType.Major);
- Assert.AreEqual("1.0.0", (string)version);
+ Assert.Equal("1.0.0", version);
}
- [Test]
+ [Fact]
public void DecrementMajorWithMinorAndPatch()
{
SemanticVersion version1 = "2.1.1";
var version = version1.Decrement(StepType.Major);
- Assert.AreEqual("1.0.0", (string)version);
+ Assert.Equal("1.0.0", version);
}
- [Test]
+ [Fact]
public void DecrementMajorError()
{
SemanticVersion version1 = "0";
Assert.Throws(() => version1.Decrement(StepType.Major));
}
- [Test]
+ [Fact]
public void DecrementMinor()
{
SemanticVersion version1 = "2.1";
var version = version1.Decrement(StepType.Minor);
- Assert.AreEqual("2.0.0", (string)version);
+ Assert.Equal("2.0.0", version);
}
- [Test]
+ [Fact]
public void DecrementMinorWithPatch()
{
SemanticVersion version1 = "2.1.1";
var version = version1.Decrement(StepType.Minor);
- Assert.AreEqual("2.0.0", (string)version);
+ Assert.Equal("2.0.0", version);
}
- [Test]
+ [Fact]
public void DecrementMinorError()
{
SemanticVersion version1 = "2.0";
Assert.Throws(() => version1.Decrement(StepType.Minor));
}
- [Test]
+ [Fact]
public void DecrementPatch()
{
SemanticVersion version1 = "2.1.1";
var version = version1.Decrement(StepType.Patch);
- Assert.AreEqual("2.1.0", (string)version);
+ Assert.Equal("2.1.0", version);
}
- [Test]
+ [Fact]
public void DecrementPatchError()
{
SemanticVersion version1 = "2.1.0";
diff --git a/Tests/packages.config b/Tests/packages.config
deleted file mode 100644
index 80dae01..0000000
--- a/Tests/packages.config
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file