diff --git a/.gitignore b/.gitignore index abd12c3..11e07c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,58 +1,73 @@ - -################# -## Eclipse -################# - -*.pydevproject -.project -.metadata -bin/** -tmp/** -tmp/**/* -*.tmp -*.bak -*.swp -*~.nib -local.properties -.classpath -.settings/ -.loadpath - -# External tool builders -.externalToolBuilders/ - -# Locally stored "Eclipse launch configurations" -*.launch - -# CDT-specific -.cproject - -# PDT-specific -.buildpath - - -################# -## Visual Studio -################# - ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. +## +## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore # User-specific files *.suo *.user +*.userosscache *.sln.docstates +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + # Build results -**/[Dd]ebug/ -**/[Rr]elease/ +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +bld/ +[Bb]in/ +[Oo]bj/ +[Ll]og/ + +# Visual Studio 2015/2017 cache/options directory +.vs/ +# Uncomment if you have tasks that create the project's static files in wwwroot +#wwwroot/ + +# Visual Studio 2017 auto generated files +Generated\ Files/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# Benchmark Results +BenchmarkDotNet.Artifacts/ + +# .NET Core +project.lock.json +project.fragment.lock.json +artifacts/ +**/Properties/launchSettings.json + +# StyleCop +StyleCopReport.xml + +# Files built by Visual Studio *_i.c *_p.c +*_i.h *.ilk *.meta *.obj +*.iobj *.pch *.pdb +*.ipdb *.pgc *.pgd *.rsp @@ -61,29 +76,80 @@ local.properties *.tli *.tlh *.tmp +*.tmp_proj +*.log *.vspscc +*.vssscc .builds -**/*.dotCover +*.pidb +*.svclog +*.scc -## TODO: If you have NuGet Package Restore enabled, uncomment this -#**/packages/ +# Chutzpah Test files +_Chutzpah* # Visual C++ cache files ipch/ *.aps *.ncb +*.opendb *.opensdf *.sdf +*.cachefile +*.VC.db +*.VC.VC.opendb # Visual Studio profiler *.psess *.vsp +*.vspx +*.sap + +# Visual Studio Trace Files +*.e2e + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState # ReSharper is a .NET coding add-in -_ReSharper* +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* -# Installshield output folder -[Ee]xpress +# DotCover is a Code Coverage Tool +*.dotCover + +# AxoCover is a Code Coverage Tool +.axoCover/* +!.axoCover/settings.json + +# Visual Studio code coverage results +*.coverage +*.coveragexml + +# NCrunch +_NCrunch_* +.*crunch*.local.xml +nCrunchTemp_* + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ # DocProject is a documentation generator add-in DocProject/buildhelp/ @@ -96,72 +162,172 @@ DocProject/Help/Html2 DocProject/Help/html # Click-Once directory -publish +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# Note: Comment the next line if you want to checkin your web deploy settings, +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# Microsoft Azure Web App publish settings. Comment the next line if you want to +# checkin your Azure Web App publish settings, but sensitive information contained +# in these scripts will be unencrypted +PublishScripts/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/[Pp]ackages/* +# except build/, which is used as an MSBuild target. +!**/[Pp]ackages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/[Pp]ackages/repositories.config +# NuGet v3's project.json files produces more ignorable files +*.nuget.props +*.nuget.targets + +# Microsoft Azure Build Output +csx/ +*.build.csdef + +# Microsoft Azure Emulator +ecf/ +rcf/ + +# Windows Store app package directories and files +AppPackages/ +BundleArtifacts/ +Package.StoreAssociation.xml +_pkginfo.txt +*.appx + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ # Others -[Bb]in -[Oo]bj -sql -TestResults -*.Cache -ClientBin -stylecop.* +ClientBin/ ~$* +*~ *.dbmdl -Generated_Code #added for RIA/Silverlight projects - -# Backup & report files from converting an old project file to a newer -# Visual Studio version. Backup files are not needed, because we have git ;-) +*.dbproj.schemaview +*.jfm +*.pfx +*.publishsettings +orleans.codegen.cs + +# Including strong name files can present a security risk +# (https://github.com/github/gitignore/pull/2483#issue-259490424) +#*.snk + +# Since there are multiple workflows, uncomment next line to ignore bower_components +# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) +#bower_components/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) _UpgradeReport_Files/ Backup*/ UpgradeLog*.XML +UpgradeLog*.htm +ServiceFabricBackup/ +*.rptproj.bak + +# SQL Server files +*.mdf +*.ldf +*.ndf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings +*.rptproj.rsuser + +# Microsoft Fakes +FakesAssemblies/ + +# GhostDoc plugin setting file +*.GhostDoc.xml + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat +node_modules/ + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt + +# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) +*.vbw + +# Visual Studio LightSwitch build output +**/*.HTMLClient/GeneratedArtifacts +**/*.DesktopClient/GeneratedArtifacts +**/*.DesktopClient/ModelManifest.xml +**/*.Server/GeneratedArtifacts +**/*.Server/ModelManifest.xml +_Pvt_Extensions +# Paket dependency manager +.paket/paket.exe +paket-files/ +# FAKE - F# Make +.fake/ -############ -## Windows -############ +# JetBrains Rider +.idea/ +*.sln.iml -# Windows image file caches -Thumbs.db +# CodeRush +.cr/ -# Folder config file -Desktop.ini +# Python Tools for Visual Studio (PTVS) +__pycache__/ +*.pyc +# Cake - Uncomment if you are using it +# tools/** +# !tools/packages.config -############# -## Python -############# +# Tabs Studio +*.tss -*.py[co] +# Telerik's JustMock configuration file +*.jmconfig -# Packages -*.egg -*.egg-info -dist -build -eggs -parts -bin -var -sdist -develop-eggs -.installed.cfg +# BizTalk build output +*.btp.cs +*.btm.cs +*.odx.cs +*.xsd.cs -# Installer logs -pip-log.txt +# OpenCover UI analysis results +OpenCover/ -# Unit test / coverage reports -.coverage -.tox +# Azure Stream Analytics local run output +ASALocalRun/ -#Translations -*.mo +# MSBuild Binary and Structured Log +*.binlog -#Mr Developer -.mr.developer.cfg +# NVidia Nsight GPU debugger configuration file +*.nvuser -# Mac crap -.DS_Store +# MFractors (Xamarin productivity tool) working folder +.mfractor/ -output +# KDIFF 3 +*.orig \ No newline at end of file diff --git a/src/Should.Core/Assertions/Assert.cs.orig b/src/Should.Core/Assertions/Assert.cs.orig deleted file mode 100644 index 275ed99..0000000 --- a/src/Should.Core/Assertions/Assert.cs.orig +++ /dev/null @@ -1,860 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using Should.Core.Exceptions; - -namespace Should.Core.Assertions -{ - /// - /// Contains various static methods that are used to verify that conditions are met during the - /// process of running tests. - /// - public class Assert - { - /// - /// Used by the Throws and DoesNotThrow methods. - /// - public delegate void ThrowsDelegate(); - - /// - /// Used by the Throws and DoesNotThrow methods. - /// - public delegate object ThrowsDelegateWithReturn(); - - /// - /// Initializes a new instance of the class. - /// - protected Assert() { } - - /// - /// Verifies that a collection contains a given object. - /// - /// The type of the object to be verified - /// The object expected to be in the collection - /// The collection to be inspected - /// Thrown when the object is not present in the collection - public static void Contains(T expected, - IEnumerable collection) - { - Contains(expected, collection, GetEqualityComparer()); - } - - /// - /// Verifies that a collection contains a given object, using an equality comparer. - /// - /// The type of the object to be verified - /// The object expected to be in the collection - /// The collection to be inspected - /// The comparer used to equate objects in the collection with the expected object - /// Thrown when the object is not present in the collection - public static void Contains(T expected, IEnumerable collection, IEqualityComparer comparer) - { - foreach (T item in collection) - if (comparer.Equals(expected, item)) - return; - - throw new ContainsException(expected); - } - - /// - /// Verifies that a string contains a given sub-string, using the current culture. - /// - /// The sub-string expected to be in the string - /// The string to be inspected - /// Thrown when the sub-string is not present inside the string - public static int Contains(string expectedSubString, - string actualString) - { - return Contains(expectedSubString, actualString, StringComparison.CurrentCulture); - } - - /// - /// Verifies that a string contains a given sub-string, using the given comparison type. - /// - /// The sub-string expected to be in the string - /// The string to be inspected - /// The type of string comparison to perform - /// Thrown when the sub-string is not present inside the string - public static int Contains(string expectedSubString, - string actualString, - StringComparison comparisonType) - { - int indexOf = actualString.IndexOf(expectedSubString, comparisonType); - - if (indexOf < 0) - throw new ContainsException(expectedSubString); - - return indexOf; - } - - /// - /// - /// - /// - /// - /// Thrown when the sub-string is not present at the start of the string - public static void StartsWith(string expectedStartString, string actualString) - { - if (actualString.StartsWith(expectedStartString) == false) - throw new StartsWithException(expectedStartString, actualString); - } - - /// - /// Verifies that a collection does not contain a given object. - /// - /// The type of the object to be compared - /// The object that is expected not to be in the collection - /// The collection to be inspected - /// Thrown when the object is present inside the container - public static void DoesNotContain(T expected, - IEnumerable collection) - { - DoesNotContain(expected, collection, GetEqualityComparer()); - } - - /// - /// Verifies that a collection does not contain a given object, using an equality comparer. - /// - /// The type of the object to be compared - /// The object that is expected not to be in the collection - /// The collection to be inspected - /// The comparer used to equate objects in the collection with the expected object - /// Thrown when the object is present inside the container - public static void DoesNotContain(T expected, IEnumerable collection, IEqualityComparer comparer) - { - foreach (T item in collection) - if (comparer.Equals(expected, item)) - throw new DoesNotContainException(expected); - } - - /// - /// Verifies that a string does not contain a given sub-string, using the current culture. - /// - /// The sub-string which is expected not to be in the string - /// The string to be inspected - /// Thrown when the sub-string is present inside the string - public static void DoesNotContain(string expectedSubString, - string actualString) - { - DoesNotContain(expectedSubString, actualString, StringComparison.CurrentCulture); - } - - /// - /// Verifies that a string does not contain a given sub-string, using the current culture. - /// - /// The sub-string which is expected not to be in the string - /// The string to be inspected - /// The type of string comparison to perform - /// Thrown when the sub-string is present inside the given string - public static void DoesNotContain(string expectedSubString, - string actualString, - StringComparison comparisonType) - { - if (actualString.IndexOf(expectedSubString, comparisonType) >= 0) - throw new DoesNotContainException(expectedSubString); - } - - ///// - ///// Verifies that a block of code does not throw any exceptions. - ///// - ///// A delegate to the code to be tested - //public static void DoesNotThrow(ThrowsDelegate testCode) - //{ - // Exception ex = Record.Exception(testCode); - - // if (ex != null) - // throw new DoesNotThrowException(ex); - //} - - /// - /// Verifies that a collection is empty. - /// - /// The collection to be inspected - /// Thrown when the collection is null - /// Thrown when the collection is not empty - public static void Empty(IEnumerable collection) - { - if (collection == null) throw new ArgumentNullException("collection", "cannot be null"); - -#pragma warning disable 168 - foreach (object @object in collection) - throw new EmptyException(); -#pragma warning restore 168 - } - - /// - /// Verifies that two objects are equal, using a default comparer. - /// - /// The type of the objects to be compared - /// The expected value - /// The value to be compared against - /// Thrown when the objects are not equal - public static void Equal(T expected, - T actual) - { - Equal(expected, actual, GetEqualityComparer()); - } - - /// - /// Verifies that two objects are equal, using a default comparer. - /// - /// The type of the objects to be compared - /// The expected value - /// The value to be compared against - /// The user message to be shown on failure - /// Thrown when the objects are not equal - public static void Equal(T expected, - T actual, - string userMessage) - { - Equal(expected, actual, GetEqualityComparer(), userMessage); - } - - /// - /// Verifies that two objects are equal, using a custom comparer. - /// - /// The type of the objects to be compared - /// The expected value - /// The value to be compared against - /// The comparer used to compare the two objects - /// Thrown when the objects are not equal - public static void Equal(T expected, - T actual, - IEqualityComparer comparer) - { - if (!comparer.Equals(expected, actual)) - throw new EqualException(expected, actual); - } - - /// - /// Verifies that two objects are equal, using a custom comparer. - /// - /// The type of the objects to be compared - /// The expected value - /// The value to be compared against - /// The comparer used to compare the two objects - /// Thrown when the objects are not equal - public static void Equal(T expected, - T actual, - IEqualityComparer comparer, - string userMessage) - { - if (!comparer.Equals(expected, actual)) - throw new EqualException(expected, actual, userMessage); - } - - /// - /// Verifies that two doubles are equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The +/- value for where the expected and actual are considered to be equal - public static void Equal(double expected, double actual, double tolerance) - { - var difference = Math.Abs(actual - expected); - if (difference > tolerance) - throw new EqualException(expected + " +/- " + tolerance, actual); - } - - /// - /// Verifies that two doubles are equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The +/- value for where the expected and actual are considered to be equal - /// The user message to be shown on failure - public static void Equal(double expected, double actual, double tolerance, string userMessage) - { - var difference = Math.Abs(actual - expected); - if (difference > tolerance) - throw new EqualException(expected + " +/- " + tolerance, actual, userMessage); - } - - /// - /// Verifies that two values are not equal, using a default comparer. - /// - /// The expected value - /// The actual value - /// The +/- value for where the expected and actual are considered to be equal - /// Thrown when the objects are equal - public static void NotEqual(double expected, double actual, double tolerance) - { - var difference = Math.Abs(actual - expected); - if (difference <= tolerance) - throw new NotEqualException(expected + " +/- " + tolerance, actual); - } - - /// - /// Verifies that two values are not equal, using a default comparer. - /// - /// The expected value - /// The actual value - /// The +/- value for where the expected and actual are considered to be equal - /// The user message to be shown on failure - /// Thrown when the objects are equal - public static void NotEqual(double expected, double actual, double tolerance, string userMessage) - { - var difference = Math.Abs(actual - expected); - if (difference <= tolerance) - throw new NotEqualException(expected + " +/- " + tolerance, actual, userMessage); - } - - /// - /// Verifies that two dates are equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The +/- value for where the expected and actual are considered to be equal - public static void Equal(DateTime expected, DateTime actual, TimeSpan tolerance) - { - var difference = Math.Abs((actual - expected).Ticks); - if (difference > tolerance.Ticks) - throw new EqualException(expected + " +/- " + tolerance, actual); - } - - /// - /// Verifies that two dates are not equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The +/- value for where the expected and actual are considered to be equal - public static void NotEqual(DateTime expected, DateTime actual, TimeSpan tolerance) - { - var difference = Math.Abs((actual - expected).Ticks); - if (difference <= tolerance.Ticks) - throw new NotEqualException(expected + " +/- " + tolerance, actual); - } - - /// - /// Verifies that two dates are equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The level of precision to use when making the comparison - public static void Equal(DateTime expected, DateTime actual, DatePrecision precision) - { - if (precision.Truncate(expected) != precision.Truncate(actual)) - throw new EqualException(precision.Truncate(actual), precision.Truncate(actual)); - } - - /// - /// Verifies that two doubles are not equal within a tolerance range. - /// - /// The expected value - /// The value to compare against - /// The level of precision to use when making the comparison - public static void NotEqual(DateTime expected, DateTime actual, DatePrecision precision) - { - if (precision.Truncate(expected) == precision.Truncate(actual)) - throw new NotEqualException(precision.Truncate(actual), precision.Truncate(actual)); - } - - /// Do not call this method. - [Obsolete("This is an override of Object.Equals(). Call Assert.Equal() instead.", true)] - public new static bool Equals(object a, - object b) - { - throw new InvalidOperationException("Assert.Equals should not be used"); - } - - /// - /// Verifies that the condition is false. - /// - /// The condition to be tested - /// Thrown if the condition is not false - public static void False(bool condition) - { - False(condition, null); - } - - /// - /// Verifies that the condition is false. - /// - /// The condition to be tested - /// The message to show when the condition is not false - /// Thrown if the condition is not false - public static void False(bool condition, - string userMessage) - { - if (condition) - throw new FalseException(userMessage); - } - - static IEqualityComparer GetEqualityComparer() - { - return new AssertEqualityComparer(); - } - - static IComparer GetComparer() - { - return new AssertComparer(); - } - - /// - /// Verifies that a value is within a given range. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// Thrown when the value is not in the given range - public static void InRange(T actual, - T low, - T high) - { - InRange(actual, low, high, GetComparer()); - } - - /// - /// Verifies that a value is within a given range, using a comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// The comparer used to evaluate the value's range - /// Thrown when the value is not in the given range - public static void InRange(T actual, - T low, - T high, - IComparer comparer) - { - if (comparer.Compare(low, actual) > 0 || comparer.Compare(actual, high) > 0) - throw new InRangeException(actual, low, high); - } - - /// - /// Verifies that an object is of the given type or a derived type. - /// - /// The type the object should be - /// The object to be evaluated - /// The object, casted to type T when successful - /// Thrown when the object is not the given type - public static T IsAssignableFrom(object @object) - { - IsAssignableFrom(typeof(T), @object); - return (T)@object; - } - - /// - /// Verifies that an object is of the given type or a derived type. - /// - /// The type the object should be - /// The object to be evaluated - /// Thrown when the object is not the given type - public static void IsAssignableFrom(Type expectedType, object @object) - { - if (@object == null || !expectedType.IsAssignableFrom(@object.GetType())) - throw new IsAssignableFromException(expectedType, @object); - } - - /// - /// Verifies that an object is of the given type or a derived type. - /// - /// The type the object should be - /// The object to be evaluated - /// The user message to show on failure - /// The object, casted to type T when successful - /// Thrown when the object is not the given type - public static T IsAssignableFrom(object @object, string userMessage) - { - IsAssignableFrom(typeof(T), @object, userMessage); - return (T)@object; - } - - /// - /// Verifies that an object is of the given type or a derived type. - /// - /// The type the object should be - /// The user message to show on failure - /// The object to be evaluated - /// Thrown when the object is not the given type - public static void IsAssignableFrom(Type expectedType, object @object, string userMessage) - { - if (@object == null || !expectedType.IsAssignableFrom(@object.GetType())) - throw new IsAssignableFromException(expectedType, @object, userMessage); - } - - /// - /// Verifies that an object is not exactly the given type. - /// - /// The type the object should not be - /// The object to be evaluated - /// Thrown when the object is the given type - public static void IsNotType(object @object) - { - IsNotType(typeof(T), @object); - } - - /// - /// Verifies that an object is not exactly the given type. - /// - /// The type the object should not be - /// The object to be evaluated - /// Thrown when the object is the given type - public static void IsNotType(Type expectedType, - object @object) - { - if (expectedType.Equals(@object.GetType())) - throw new IsNotTypeException(expectedType, @object); - } - - /// - /// Verifies that an object is exactly the given type (and not a derived type). - /// - /// The type the object should be - /// The object to be evaluated - /// The object, casted to type T when successful - /// Thrown when the object is not the given type - public static T IsType(object @object) - { - IsType(typeof(T), @object); - return (T)@object; - } - - /// - /// Verifies that an object is exactly the given type (and not a derived type). - /// - /// The type the object should be - /// The object to be evaluated - /// Thrown when the object is not the given type - public static void IsType(Type expectedType, - object @object) - { - if (@object == null || !expectedType.Equals(@object.GetType())) - throw new IsTypeException(expectedType, @object); - } - - /// - /// Verifies that a collection is not empty. - /// - /// The collection to be inspected - /// Thrown when a null collection is passed - /// Thrown when the collection is empty - public static void NotEmpty(IEnumerable collection) - { - if (collection == null) throw new ArgumentNullException("collection", "cannot be null"); - -#pragma warning disable 168 - foreach (object @object in collection) - return; -#pragma warning restore 168 - - throw new NotEmptyException(); - } - - /// - /// Verifies that two objects are not equal, using a default comparer. - /// - /// The type of the objects to be compared - /// The expected object - /// The actual object - /// Thrown when the objects are equal - public static void NotEqual(T expected, - T actual) - { - NotEqual(expected, actual, GetEqualityComparer()); - } - - /// - /// Verifies that two objects are not equal, using a custom comparer. - /// - /// The type of the objects to be compared - /// The expected object - /// The actual object - /// The comparer used to examine the objects - /// Thrown when the objects are equal - public static void NotEqual(T expected, - T actual, - IEqualityComparer comparer) - { - if (comparer.Equals(expected, actual)) - throw new NotEqualException(expected, actual); - } - - /// - /// Verifies that a value is not within a given range, using the default comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// Thrown when the value is in the given range - public static void NotInRange(T actual, - T low, - T high) - { - NotInRange(actual, low, high, GetComparer()); - } - - /// - /// Verifies that a value is not within a given range, using a comparer. - /// - /// The type of the value to be compared - /// The actual value to be evaluated - /// The (inclusive) low value of the range - /// The (inclusive) high value of the range - /// The comparer used to evaluate the value's range - /// Thrown when the value is in the given range - public static void NotInRange(T actual, - T low, - T high, - IComparer comparer) - { - if (comparer.Compare(low, actual) <= 0 && comparer.Compare(actual, high) <= 0) - throw new NotInRangeException(actual, low, high); - } - - /// - /// Verifies that an object reference is not null. - /// - /// The object to be validated - /// Thrown when the object is not null - public static void NotNull(object @object) - { - if (@object == null) - throw new NotNullException(); - } - - /// - /// Verifies that an object reference is not null. - /// - /// The object to be validated - /// Thrown when the object is not null - public static void NotNull(object @object, string message) - { - if (@object == null) - throw new NotNullException(message); - } - - /// - /// Verifies that two objects are not the same instance. - /// - /// The expected object instance - /// The actual object instance - /// Thrown when the objects are the same instance - public static void NotSame(object expected, - object actual) - { - if (object.ReferenceEquals(expected, actual)) - throw new NotSameException(); - } - - /// - /// Verifies that an object reference is null. - /// - /// The object to be inspected - /// Thrown when the object reference is not null - public static void Null(object @object) - { - if (@object != null) - throw new NullException(@object); - } - - /// - /// Verifies that two objects are the same instance. - /// - /// The expected object instance - /// The actual object instance - /// Thrown when the objects are not the same instance - public static void Same(object expected, - object actual) - { - if (!object.ReferenceEquals(expected, actual)) - throw new SameException(expected, actual); - } - - /// - /// Verifies that the given collection contains only a single - /// element of the given type. - /// - /// The collection. - /// The single item in the collection. - /// Thrown when the collection does not contain - /// exactly one element. - public static object Single(IEnumerable collection) - { - if (collection == null) - throw new ArgumentNullException("collection"); - - int count = 0; - object result = null; - - foreach (object item in collection) - { - result = item; - ++count; - } - - if (count != 1) - throw new SingleException(count); - - return result; - } - - /// - /// Verifies that the given collection contains only a single - /// element of the given type. - /// - /// The collection type. - /// The collection. - /// The single item in the collection. - /// Thrown when the collection does not contain - /// exactly one element. - public static T Single(IEnumerable collection) - { - if (collection == null) - throw new ArgumentNullException("collection"); - - int count = 0; - T result = default(T); - - foreach (T item in collection) - { - result = item; - ++count; - } - - if (count != 1) - throw new SingleException(count); - - return result; - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// - /// The type of the exception expected to be thrown - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static T Throws(ThrowsDelegate testCode) - where T : Exception - { - return (T)Throws(typeof(T), testCode); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// - /// The type of the exception expected to be thrown - /// The message to be shown if the test fails - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static T Throws(string userMessage, - ThrowsDelegate testCode) - where T : Exception - { - return (T)Throws(typeof(T), testCode); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// Generally used to test property accessors. - /// - /// The type of the exception expected to be thrown - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static T Throws(ThrowsDelegateWithReturn testCode) - where T : Exception - { - return (T)Throws(typeof(T), testCode); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// Generally used to test property accessors. - /// - /// The type of the exception expected to be thrown - /// The message to be shown if the test fails - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static T Throws(string userMessage, - ThrowsDelegateWithReturn testCode) - where T : Exception - { - return (T)Throws(typeof(T), testCode); - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// - /// The type of the exception expected to be thrown - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static Exception Throws(Type exceptionType, - ThrowsDelegate testCode) - { - Exception exception = Record.Exception(testCode); - - if (exception == null) - throw new ThrowsException(exceptionType); - - if (!exceptionType.Equals(exception.GetType())) - throw new ThrowsException(exceptionType, exception); - - return exception; - } - - /// - /// Verifies that the exact exception is thrown (and not a derived exception type). - /// Generally used to test property accessors. - /// - /// The type of the exception expected to be thrown - /// A delegate to the code to be tested - /// The exception that was thrown, when successful - /// Thrown when an exception was not thrown, or when an exception of the incorrect type is thrown - public static Exception Throws(Type exceptionType, - ThrowsDelegateWithReturn testCode) - { - Exception exception = Record.Exception(testCode); - - if (exception == null) - throw new ThrowsException(exceptionType); - - if (!exceptionType.Equals(exception.GetType())) - throw new ThrowsException(exceptionType, exception); - - return exception; - } - - /// - /// Verifies that a block of code does not throw any exceptions. - /// - /// A delegate to the code to be tested - public static void DoesNotThrow(ThrowsDelegate testCode) - { - Exception ex = Record.Exception(testCode); - - if (ex != null) - throw new DoesNotThrowException(ex); - } - - /// - /// Verifies that an expression is true. - /// - /// The condition to be inspected - /// Thrown when the condition is false - public static void True(bool condition) - { - True(condition, null); - } - - /// - /// Verifies that an expression is true. - /// - /// The condition to be inspected - /// The message to be shown when the condition is false - /// Thrown when the condition is false - public static void True(bool condition, - string userMessage) - { - if (!condition) - throw new TrueException(userMessage); - } - } -} \ No newline at end of file diff --git a/src/Should.Core/Should.Core.csproj b/src/Should.Core/Should.Core.csproj index b942234..ec175b8 100644 --- a/src/Should.Core/Should.Core.csproj +++ b/src/Should.Core/Should.Core.csproj @@ -1,102 +1,5 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {984764C1-D102-43AD-8DE9-0AA3B7E5D431} - Library - Properties - Should.Core - Should.Core - v3.5 - 512 - - - 3.5 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + netcoreapp2.2 + \ No newline at end of file diff --git a/src/Should.Core/Should.Core.csproj.orig b/src/Should.Core/Should.Core.csproj.orig deleted file mode 100644 index 6120499..0000000 --- a/src/Should.Core/Should.Core.csproj.orig +++ /dev/null @@ -1,97 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {984764C1-D102-43AD-8DE9-0AA3B7E5D431} - Library - Properties - Should.Core - Should.Core - v3.5 - 512 - - - 3.5 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/BeBoolSpecs.cs b/src/Should.Fluent.UnitTests/BeBoolSpecs.cs index dd9c8c1..aaebacc 100644 --- a/src/Should.Fluent.UnitTests/BeBoolSpecs.cs +++ b/src/Should.Fluent.UnitTests/BeBoolSpecs.cs @@ -1,6 +1,6 @@ using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { diff --git a/src/Should.Fluent.UnitTests/BeDateTimeSpecs.cs b/src/Should.Fluent.UnitTests/BeDateTimeSpecs.cs index 2edda76..737b1cf 100644 --- a/src/Should.Fluent.UnitTests/BeDateTimeSpecs.cs +++ b/src/Should.Fluent.UnitTests/BeDateTimeSpecs.cs @@ -1,7 +1,7 @@ using System; using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { diff --git a/src/Should.Fluent.UnitTests/BeDateTimeSpecs.cs.orig b/src/Should.Fluent.UnitTests/BeDateTimeSpecs.cs.orig deleted file mode 100644 index 9d6b366..0000000 --- a/src/Should.Fluent.UnitTests/BeDateTimeSpecs.cs.orig +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using Machine.Specifications; -using Should.Fluent.Model; -using It=Machine.Specifications.It; - -namespace Should.Fluent.UnitTests -{ - public class be_datetime_test_base : test_base - { - protected static BeBase be; - Establish context = () => target = DateTime.Now; - } - - public class should_be_datetime_context : be_datetime_test_base - { -<<<<<<< local - Establish context = () => be = new ShouldDateTime(target, mockAssertProvider.Object).Be; -======= - Establish context = () => be = new Should>(target, mockAssertProvider.Object).Be; ->>>>>>> other - } - - public class should_not_be_datetime_context : be_datetime_test_base - { -<<<<<<< local - Establish context = () => be = new ShouldDateTime(target, mockAssertProvider.Object).Not.Be; -======= - Establish context = () => be = new Should>(target, mockAssertProvider.Object).Not.Be; ->>>>>>> other - } - - public class when_calling_today : should_be_datetime_context - { - Because of = () => result = be.Today(); - Behaves_like> yes; - It should_call_areequal = () => Called(x => x.AreEqual(DateTime.Today, target.Date)); - } - - public class when_calling_not_today : should_not_be_datetime_context - { - Because of = () => result = be.Today(); - Behaves_like> yes; - It should_call_arenotequal = () => Called(x => x.AreNotEqual(DateTime.Today, target.Date)); - } -} \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/BeEnumerableSpecs.cs b/src/Should.Fluent.UnitTests/BeEnumerableSpecs.cs index 640b4b2..91e55ce 100644 --- a/src/Should.Fluent.UnitTests/BeEnumerableSpecs.cs +++ b/src/Should.Fluent.UnitTests/BeEnumerableSpecs.cs @@ -2,7 +2,7 @@ using System.Linq; using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { diff --git a/src/Should.Fluent.UnitTests/BeGuidSpecs.cs b/src/Should.Fluent.UnitTests/BeGuidSpecs.cs index 4fd6972..098cb63 100644 --- a/src/Should.Fluent.UnitTests/BeGuidSpecs.cs +++ b/src/Should.Fluent.UnitTests/BeGuidSpecs.cs @@ -1,7 +1,7 @@ using System; using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { diff --git a/src/Should.Fluent.UnitTests/BeGuidSpecs.cs.orig b/src/Should.Fluent.UnitTests/BeGuidSpecs.cs.orig deleted file mode 100644 index 50656ad..0000000 --- a/src/Should.Fluent.UnitTests/BeGuidSpecs.cs.orig +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using Machine.Specifications; -using Should.Fluent.Model; -using It=Machine.Specifications.It; - -namespace Should.Fluent.UnitTests -{ - public class be_guid_test_base : test_base - { - protected static BeGuid be; - } - - public class should_be_guid_context : be_guid_test_base - { - Establish context = () => be = new Should(target, mockAssertProvider.Object).Be; - } - - public class should_not_be_guid_context : be_guid_test_base - { - Establish context = () => be = new Should(target, mockAssertProvider.Object).Not.Be; - } - - public class when_calling_guid_empty : should_be_guid_context - { - Because of = () => result = be.Empty(); - Behaves_like> yes; - It should_assert_areequal = () => Called(x => x.AreEqual(Guid.Empty, target)); - } - - public class when_calling_guid_not_empty : should_not_be_guid_context - { - Because of = () => result = be.Empty(); - Behaves_like> yes; - It should_assert_arenotequal = () => Called(x => x.AreNotEqual(Guid.Empty, target)); - } -} \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/BeMethodCallExpressionSpecs.cs b/src/Should.Fluent.UnitTests/BeMethodCallExpressionSpecs.cs index 501db73..ac9b08a 100644 --- a/src/Should.Fluent.UnitTests/BeMethodCallExpressionSpecs.cs +++ b/src/Should.Fluent.UnitTests/BeMethodCallExpressionSpecs.cs @@ -2,7 +2,7 @@ using System.Linq.Expressions; using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; using IT = Moq.It; namespace Should.Fluent.UnitTests diff --git a/src/Should.Fluent.UnitTests/BeNullableBoolSpecs.cs b/src/Should.Fluent.UnitTests/BeNullableBoolSpecs.cs index ae98edf..bf860d3 100644 --- a/src/Should.Fluent.UnitTests/BeNullableBoolSpecs.cs +++ b/src/Should.Fluent.UnitTests/BeNullableBoolSpecs.cs @@ -1,6 +1,6 @@ using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { diff --git a/src/Should.Fluent.UnitTests/BeNullableDateTimeSpecs.cs b/src/Should.Fluent.UnitTests/BeNullableDateTimeSpecs.cs index de2eea7..636788a 100644 --- a/src/Should.Fluent.UnitTests/BeNullableDateTimeSpecs.cs +++ b/src/Should.Fluent.UnitTests/BeNullableDateTimeSpecs.cs @@ -1,7 +1,7 @@ using System; using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { diff --git a/src/Should.Fluent.UnitTests/BeSpecs.cs b/src/Should.Fluent.UnitTests/BeSpecs.cs index 860b4fe..b5c986e 100644 --- a/src/Should.Fluent.UnitTests/BeSpecs.cs +++ b/src/Should.Fluent.UnitTests/BeSpecs.cs @@ -1,7 +1,7 @@ using System; using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { diff --git a/src/Should.Fluent.UnitTests/BeStringSpecs.cs b/src/Should.Fluent.UnitTests/BeStringSpecs.cs index 845e01b..d7cf78d 100644 --- a/src/Should.Fluent.UnitTests/BeStringSpecs.cs +++ b/src/Should.Fluent.UnitTests/BeStringSpecs.cs @@ -1,6 +1,6 @@ using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { diff --git a/src/Should.Fluent.UnitTests/Behaviors.cs b/src/Should.Fluent.UnitTests/Behaviors.cs index 6c6f8b9..1fe3aab 100644 --- a/src/Should.Fluent.UnitTests/Behaviors.cs +++ b/src/Should.Fluent.UnitTests/Behaviors.cs @@ -1,7 +1,7 @@ using System; using Machine.Specifications; -using NUnit.Framework; using Should.Core.Exceptions; +using Xunit; namespace Should.Fluent.UnitTests { @@ -12,8 +12,8 @@ public class Throws where T : AssertException It should_throw_assert_exception_of_expected_type = () => { - Assert.IsNotNull(exception); - Assert.IsInstanceOfType(typeof(T), exception); + Assert.NotNull(exception); + Assert.IsType(exception); }; } @@ -21,6 +21,6 @@ public class Throws where T : AssertException public class DoesNotThrow { protected static Exception exception; - It should_throw_not_equal_exception = () => Assert.IsNull(exception); + It should_throw_not_equal_exception = () => Assert.Null(exception); } } \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/ContainsSpecs.cs b/src/Should.Fluent.UnitTests/ContainsSpecs.cs index bb25102..94f8c82 100644 --- a/src/Should.Fluent.UnitTests/ContainsSpecs.cs +++ b/src/Should.Fluent.UnitTests/ContainsSpecs.cs @@ -3,7 +3,7 @@ using System.Linq; using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { diff --git a/src/Should.Fluent.UnitTests/CountSpecs.cs b/src/Should.Fluent.UnitTests/CountSpecs.cs index eef4d17..2d41395 100644 --- a/src/Should.Fluent.UnitTests/CountSpecs.cs +++ b/src/Should.Fluent.UnitTests/CountSpecs.cs @@ -4,7 +4,7 @@ using System.Linq; using Machine.Specifications; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { diff --git a/src/Should.Fluent.UnitTests/CountSpecs.cs.orig b/src/Should.Fluent.UnitTests/CountSpecs.cs.orig deleted file mode 100644 index bdbdfe3..0000000 --- a/src/Should.Fluent.UnitTests/CountSpecs.cs.orig +++ /dev/null @@ -1,212 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using Machine.Specifications; -using Should.Fluent.Model; -using It=Machine.Specifications.It; - -namespace Should.Fluent.UnitTests -{ - public class count_base : test_base> - { - protected static Count count; - Establish context = () => target = new List(new[] { "foo", "bar", "foo" }); - } - - public class should_count_context : count_base - { - Establish context = () => count = new ShouldEnumerable(target, mockAssertProvider.Object).Count; - } - - public class should_not_count_context : should_count_context - { - Establish context = () => count = new ShouldEnumerable(target, mockAssertProvider.Object).Not.Count; - } - - public class when_calling_exactly : should_count_context - { - Because of = () => result = count.Exactly(3); - Behaves_like>> yes; - It should_call_areequal = () => Called(x => x.AreEqual(3, 3)); - } - - public class when_calling_not_exactly : should_not_count_context - { - Because of = () => result = count.Exactly(4); - Behaves_like>> yes; - It should_call_arenotequal = () => Called(x => x.AreNotEqual(4, 3)); - } - - public class when_calling_at_least : should_count_context - { - Because of = () => result = count.AtLeast(2); - Behaves_like>> yes; -<<<<<<< local - It should_assert_greaterthanorequal = () => Called(x => x.GreaterOrEqual(3, 2)); -======= - It should_assert_greaterthanorequal = () => Called(x => x.GreaterThanOrEqual(target.Count(), 2)); ->>>>>>> other - } - - public class when_calling_not_at_least : should_not_count_context - { - Because of = () => result = count.AtLeast(4); - Behaves_like>> yes; -<<<<<<< local - It should_assert_greaterthanorequal = () => Called(x => x.GreaterOrEqual(4, 3)); -======= - It should_assert_greaterthanorequal = () => Called(x => x.LessThan(target.Count(), 4)); ->>>>>>> other - } - - public class when_calling_no_more_than : should_count_context - { - Because of = () => result = count.NoMoreThan(3); - Behaves_like>> yes; -<<<<<<< local - It should_assert_greaterthanorequal = () => Called(x => x.GreaterOrEqual(3, 3)); -======= - It should_assert_greaterthanorequal = () => Called(x => x.LessThanOrEqual(target.Count(), 3)); ->>>>>>> other - } - - public class when_calling_not_at_leat : should_not_count_context - { - Because of = () => result = count.AtLeast(2); - Behaves_like>> yes; -<<<<<<< local - It should_assert_greaterthanorequal = () => Called(x => x.GreaterOrEqual(2, 3)); -======= - It should_assert_greaterthanorequal = () => Called(x => x.LessThan(target.Count(), 2)); ->>>>>>> other - } - - public class when_calling_zero : should_count_context - { - Because of = () => result = count.Zero(); - Behaves_like>> yes; - It should_call_areequal = () => Called(x => x.AreEqual(0, 3)); - } - - public class when_calling_not_zero : should_not_count_context - { - Because of = () => result = count.Zero(); - Behaves_like>> yes; - It should_call_arenotequal = () => Called(x => x.AreNotEqual(0, 3)); - } - - public class collection_context : test_base - { - protected static Count count; - Establish context = () => target = new MyCollection(10); - } - - public class should_collection_count_context : collection_context - { - Establish context = () => count = new ShouldCollection(target, mockAssertProvider.Object).Count; - } - - public class should_collection_not_count_context : collection_context - { - Establish context = () => count = new ShouldCollection(target, mockAssertProvider.Object).Not.Count; - } - - public class when_called_exactly : should_collection_count_context - { - Because of = () => count.Exactly(10); - It should_call_areequal = () => Called(x => x.AreEqual(10, 10)); - } - - public class when_called_atleast : should_collection_count_context - { - Because of = () => count.AtLeast(10); -<<<<<<< local - It should_call_greater_or_equal = () => Called(x => x.GreaterOrEqual(10, 10)); -======= - It should_cale_greater_or_equal = () => Called(x => x.GreaterThanOrEqual(10, target.Count)); ->>>>>>> other - } - - public class when_called_no_more_than: should_collection_count_context - { - Because of = () => count.NoMoreThan(10); -<<<<<<< local - It should_call_greater_or_equal = () => Called(x => x.GreaterOrEqual(10, 10)); -======= - It should_call_greater_or_equal = () => Called(x => x.LessThanOrEqual(10, target.Count)); ->>>>>>> other - } - - public class when_called_zero : should_collection_count_context - { - Because of = () => count.Zero(); - It should_call_areequal = () => Called(x => x.AreEqual(0, 10)); - } - - public class when_called_not_exactly : should_collection_not_count_context - { - Because of = () => count.Exactly(10); - It should_call_areequal = () => Called(x => x.AreNotEqual(10, 10)); - } - - public class when_called_not_atleast : should_collection_not_count_context - { - Because of = () => count.AtLeast(10); -<<<<<<< local - It should_call_greater_or_equal = () => Called(x => x.GreaterOrEqual(10, 10)); -======= - It should_cale_greater_or_equal = () => Called(x => x.LessThan(target.Count, 10)); ->>>>>>> other - } - - public class when_called_not_no_more_than : should_collection_not_count_context - { - Because of = () => count.NoMoreThan(10); -<<<<<<< local - It should_call_greater_or_equal = () => Called(x => x.GreaterOrEqual(10, 10)); -======= - It should_call_greater_or_equal = () => Called(x => x.GreaterThan(target.Count, 10)); ->>>>>>> other - } - - public class when_called_not_zero : should_collection_not_count_context - { - Because of = () => count.Zero(); - It should_call_areequal = () => Called(x => x.AreNotEqual(0, 10)); - } - - public class MyCollection : ICollection - { - private readonly int count; - - public MyCollection(int count) - { - this.count = count; - } - - public IEnumerator GetEnumerator() - { - return null; - } - - public void CopyTo(Array array, int index) - { - } - - public int Count - { - get { return count; } - } - - public object SyncRoot - { - get { return null; } - } - - public bool IsSynchronized - { - get { return false; } - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/Properties/AssemblyInfo.cs b/src/Should.Fluent.UnitTests/Properties/AssemblyInfo.cs deleted file mode 100644 index a852f19..0000000 --- a/src/Should.Fluent.UnitTests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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("Should.Fluent.UnitTests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("Should.Fluent.UnitTests")] -[assembly: AssemblyCopyright("Copyright © 2010")] -[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("c96faf77-7fa1-4d05-8bfa-7ba5043244c3")] - -// 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/src/Should.Fluent.UnitTests/Should.Fluent.UnitTests.csproj b/src/Should.Fluent.UnitTests/Should.Fluent.UnitTests.csproj index c851e86..70f13b6 100644 --- a/src/Should.Fluent.UnitTests/Should.Fluent.UnitTests.csproj +++ b/src/Should.Fluent.UnitTests/Should.Fluent.UnitTests.csproj @@ -1,111 +1,21 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A2973D4C-660C-42C8-A610-3B69170B6932} - Library - Properties - Should.Fluent.UnitTests - Should.Fluent.UnitTests - v3.5 - 512 - - - 3.5 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 169 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\..\lib\Machine.Specifications.0.5.6.0\lib\net20\Machine.Specifications.dll - - - False - ..\..\lib\MOQ\Moq.dll - - - ..\..\lib\NUnit.2.6.0.12054\lib\nunit.framework.dll - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {984764C1-D102-43AD-8DE9-0AA3B7E5D431} - Should.Core - - - {20743DBF-AEF5-464B-9C9B-8109AD43AA5A} - Should.Fluent - - - - - - - - \ No newline at end of file + + + + netcoreapp2.2 + + false + + + + + + + + + + + + + + + diff --git a/src/Should.Fluent.UnitTests/Should.Fluent.UnitTests.csproj.orig b/src/Should.Fluent.UnitTests/Should.Fluent.UnitTests.csproj.orig deleted file mode 100644 index dce7eac..0000000 --- a/src/Should.Fluent.UnitTests/Should.Fluent.UnitTests.csproj.orig +++ /dev/null @@ -1,110 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A2973D4C-660C-42C8-A610-3B69170B6932} - Library - Properties - Should.Fluent.UnitTests - Should.Fluent.UnitTests - v3.5 - 512 - - - 3.5 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - 169 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\..\lib\mSpec\Machine.Specifications.dll - - - False - ..\..\lib\MOQ\Moq.dll - - - False - ..\..\lib\mSpec\nunit.framework.dll - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {984764C1-D102-43AD-8DE9-0AA3B7E5D431} - Should.Core - - - {20743DBF-AEF5-464B-9C9B-8109AD43AA5A} - Should.Fluent - - - - - \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/ShouldCoreProviderSpecs.cs b/src/Should.Fluent.UnitTests/ShouldCoreProviderSpecs.cs index 107203a..13bfb3c 100644 --- a/src/Should.Fluent.UnitTests/ShouldCoreProviderSpecs.cs +++ b/src/Should.Fluent.UnitTests/ShouldCoreProviderSpecs.cs @@ -1,6 +1,5 @@ using System; using Machine.Specifications; -using NUnit.Framework; using Should.Core; using Should.Core.Exceptions; diff --git a/src/Should.Fluent.UnitTests/ShouldCoreProviderSpecs.cs.orig b/src/Should.Fluent.UnitTests/ShouldCoreProviderSpecs.cs.orig deleted file mode 100644 index 87418ef..0000000 --- a/src/Should.Fluent.UnitTests/ShouldCoreProviderSpecs.cs.orig +++ /dev/null @@ -1,430 +0,0 @@ -using System; -using Machine.Specifications; -<<<<<<< local -using NUnit.Framework; -using Should.Core; -======= ->>>>>>> other -using Should.Core.Exceptions; - -namespace Should.Fluent.UnitTests -{ - public class assert_provider_context - { - protected static ShouldCoreAssertProvider provider; - protected static Exception exception; - - Establish context = () => provider = new ShouldCoreAssertProvider(); - - protected static void Try(Action assertAction) - { - exception = Catch.Exception(assertAction); - } - } - - public class when_assert_are_equal_passes : assert_provider_context - { - Because of = () => Try(() => provider.AreEqual(1, 1)); - Behaves_like yes; - } - - public class when_assert_are_equal_fails : assert_provider_context - { - Because of = () => Try(() => provider.AreEqual(1, 2)); - Behaves_like> yes; - } - - public class when_assert_are_not_equal_passes : assert_provider_context - { - Because of = () => Try(() => provider.AreNotEqual(1, 2)); - Behaves_like yes; - } - - public class when_assert_are_not_equal_fails : assert_provider_context - { - Because of = () => Try(() => provider.AreNotEqual(1, 1)); - Behaves_like> yes; - } - - public class when_assert_doubles_are_equal_within_tolerance_passes : assert_provider_context - { - Because of = () => Try(() => provider.AreEqual(1.001, 1, 0.001)); - Behaves_like yes; - } - - public class when_assert_doubles_are_equal_within_tolerance_fails : assert_provider_context - { - Because of = () => Try(() => provider.AreEqual(1.0011, 1, 0.001)); - Behaves_like> yes; - } - - public class when_assert_doubles_are_not_equal_within_tolerance_passes : assert_provider_context - { - Because of = () => Try(() => provider.AreNotEqual(1.0011, 1, 0.001)); - Behaves_like yes; - } - - public class when_assert_doubles_are_not_equal_within_tolerance_fails : assert_provider_context - { - Because of = () => Try(() => provider.AreNotEqual(1.001, 1, 0.001)); - Behaves_like> yes; - } - - public class beahves_like_date_equality_spec : assert_provider_context - { - protected static DateTime expected = new DateTime(2000, 1, 1, 1, 35, 0); - protected static DateTime actual = expected.AddMinutes(5); - } - - public class when_assert_dates_are_equal_within_tolerance_passes : beahves_like_date_equality_spec - { - Because of = () => Try(() => provider.AreEqual(expected, actual, TimeSpan.FromMinutes(5))); - Behaves_like yes; - } - - public class when_assert_dates_are_equal_within_tolerance_fails : beahves_like_date_equality_spec - { - Because of = () => Try(() => provider.AreEqual(expected, actual, TimeSpan.FromMinutes(4))); - Behaves_like> yes; - } - - public class when_assert_dates_are_not_equal_within_tolerance_passes : beahves_like_date_equality_spec - { - Because of = () => Try(() => provider.AreNotEqual(expected, actual, TimeSpan.FromMinutes(4))); - Behaves_like yes; - } - - public class when_assert_dates_are_not_equal_within_tolerance_fails : beahves_like_date_equality_spec - { - Because of = () => Try(() => provider.AreNotEqual(expected, actual, TimeSpan.FromMinutes(5))); - Behaves_like> yes; - } - - public class when_assert_dates_are_equal_with_precision_passes : beahves_like_date_equality_spec - { - Because of = () => Try(() => provider.AreEqual(expected, actual, DatePrecision.Hour)); - Behaves_like yes; - } - - public class when_assert_dates_are_equal_with_precision_fails : beahves_like_date_equality_spec - { - Because of = () => Try(() => provider.AreEqual(expected, actual, DatePrecision.Minute)); - Behaves_like> yes; - } - - public class when_assert_dates_are_not_equal_with_precision_passes : beahves_like_date_equality_spec - { - Because of = () => Try(() => provider.AreNotEqual(expected, actual, DatePrecision.Minute)); - Behaves_like yes; - } - - public class when_assert_dates_are_not_equal_with_precision_fails : beahves_like_date_equality_spec - { - Because of = () => Try(() => provider.AreNotEqual(expected, actual, DatePrecision.Hour)); - Behaves_like> yes; - } - - public class when_assert_not_null_passes : assert_provider_context - { - Because of = () => Try(() => provider.IsNotNull(1)); - Behaves_like yes; - } - - public class when_assert_not_null_fails : assert_provider_context - { - Because of = () => Try(() => provider.IsNotNull(null)); - Behaves_like> yes; - } - - public class when_assert_null_passes : assert_provider_context - { - Because of = () => Try(() => provider.IsNull(null)); - Behaves_like yes; - } - - public class when_assert_null_fails : assert_provider_context - { - Because of = () => Try(() => provider.IsNull(1)); - Behaves_like> yes; - } - - public class when_assert_true_passes : assert_provider_context - { - Because of = () => Try(() => provider.IsTrue(true)); - Behaves_like yes; - } - - public class when_assert_true_fails : assert_provider_context - { - Because of = () => Try(() => provider.IsTrue(false)); - Behaves_like> yes; - } - - public class when_assert_false_passes : assert_provider_context - { - Because of = () => Try(() => provider.IsFalse(false)); - Behaves_like yes; - } - - public class when_assert_false_fails : assert_provider_context - { - Because of = () => Try(() => provider.IsFalse(true)); - Behaves_like> yes; - } - - public class when_assert_fail : assert_provider_context - { - Because of = () => Try(() => provider.Fail("message")); - Behaves_like> yes; - } - - public class when_assert_contains_passes : assert_provider_context - { - Because of = () => Try(() => provider.Contains(1, new [] { 1 })); - Behaves_like yes; - } - - public class when_assert_contains_fails : assert_provider_context - { - Because of = () => Try(() => provider.Contains(1, new[] { 2 })); - Behaves_like> yes; - } - - public class when_assert_not_contains_passes : assert_provider_context - { - Because of = () => Try(() => provider.NotContains(1, new[] { 2 })); - Behaves_like yes; - } - - public class when_assert_not_contains_fails : assert_provider_context - { - Because of = () => Try(() => provider.NotContains(1, new[] { 1 })); - Behaves_like> yes; - } - - public class when_assert_greater_passes : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThan(2, 1)); - Behaves_like yes; - } - - public class when_assert_greater_than_fails : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThan(1, 2)); - Behaves_like> yes; - } - - public class when_assert_greater_than_passes : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThan(2, 1)); - Behaves_like yes; - } - - public class when_assert_greater_than_with_comparer_fails : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThan("A", "a", StringComparer.Ordinal)); - Behaves_like> yes; - } - - public class when_assert_greater_than_with_comparer_passes : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThan("a", "A", StringComparer.Ordinal)); - Behaves_like yes; - } - - public class when_assert_greater_than_or_equal_to_fails : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThanOrEqual(1, 2)); - Behaves_like> yes; - } - - public class when_assert_greater_than_or_equal_to_passes : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThanOrEqual(1, 1)); - Behaves_like yes; - } - - public class when_assert_greater_than_or_equal_to_with_comparer_fails : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThanOrEqual("A", "a", StringComparer.Ordinal)); - Behaves_like> yes; - } - - public class when_assert_greater_than_or_equal_to_with_comparer_passes : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThanOrEqual("a", "A", StringComparer.OrdinalIgnoreCase)); - Behaves_like yes; - } - - public class when_assert_less_than_fails : assert_provider_context - { - Because of = () => Try(() => provider.LessThan(2, 1)); - Behaves_like> yes; - } - - public class when_assert_less_than_passes : assert_provider_context - { - Because of = () => Try(() => provider.LessThan(1, 2)); - Behaves_like yes; - } - - public class when_assert_less_than_with_comparer_fails : assert_provider_context - { - Because of = () => Try(() => provider.LessThan("a", "A", StringComparer.Ordinal)); - Behaves_like> yes; - } - - public class when_assert_less_than_with_comparer_passes : assert_provider_context - { - Because of = () => Try(() => provider.LessThan("A", "a", StringComparer.Ordinal)); - Behaves_like yes; - } - - public class when_assert_less_than_or_equal_to_fails : assert_provider_context - { - Because of = () => Try(() => provider.LessThanOrEqual(2, 1)); - Behaves_like> yes; - } - - public class when_assert_less_than_or_equal_to_passes : assert_provider_context - { - Because of = () => Try(() => provider.LessThanOrEqual(1, 1)); - Behaves_like yes; - } - - public class when_assert_less_than_or_equal_to_with_comparer_fails : assert_provider_context - { - Because of = () => Try(() => provider.LessThanOrEqual("a", "A", StringComparer.Ordinal)); - Behaves_like> yes; - } - - public class when_assert_less_than_or_equal_to_with_comparer_passes : assert_provider_context - { - Because of = () => Try(() => provider.LessThanOrEqual("a", "A", StringComparer.OrdinalIgnoreCase)); - Behaves_like yes; - } - - public class when_assert_not_greater_fails : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThan(1, 1)); - Behaves_like> yes; - } - - public class when_assert_greater_or_equal_passes : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThanOrEqual(1, 1)); - Behaves_like yes; - } - - public class when_assert_not_greater_or_equal_fails : assert_provider_context - { - Because of = () => Try(() => provider.GreaterThanOrEqual(1, 2)); - Behaves_like> yes; - } - - public class sameness_test : assert_provider_context - { - protected static Foo foo1; - protected static Foo foo2; - } - - public class same_context : sameness_test - { - Establish context = () => - { - foo1 = new Foo("foo"); - foo2 = foo1; - }; - } - - public class not_same_context : sameness_test - { - Establish context = () => - { - foo1 = new Foo("foo"); - foo2 = new Foo("foo"); - }; - } - - public class when_assert_are_same_passes : same_context - { - Because of = () => Try(() => provider.AreSame(foo1, foo2)); - Behaves_like yes; - } - - public class when_assert_not_are_same_fails : not_same_context - { - Because of = () => Try(() => provider.AreSame(foo1, foo2)); - Behaves_like> yes; - } - - public class when_assert_are_not_same_passes : not_same_context - { - Because of = () => Try(() => provider.AreNotSame(foo1, foo2)); - Behaves_like yes; - } - - public class when_assert_not_are_not_same_fails : same_context - { - Because of = () => Try(() => provider.AreNotSame(foo1, foo2)); - Behaves_like> yes; - } - - public class when_assert_is_substring_of_passes : assert_provider_context - { - Because of = () => Try(() => provider.IsSubstringOf("test", "te")); - Behaves_like yes; - } - - public class when_assert_is_substring_of_fails : assert_provider_context - { - Because of = () => Try(() => provider.IsSubstringOf("test", "xx")); - Behaves_like> yes; - } - - public class when_assert_is_instance_of_passes : assert_provider_context - { - Because of = () => Try(() => provider.IsInstanceOfType(new Foo("foo"), typeof(Foo))); - Behaves_like yes; - } - - public class when_assert_is_instance_of_fails : assert_provider_context - { - Because of = () => Try(() => provider.IsInstanceOfType(new Foo("foo"), typeof(string))); - Behaves_like> yes; - } - - public class when_assert_is_not_instance_of_passes : assert_provider_context - { - Because of = () => Try(() => provider.IsNotInstanceOfType(new Foo("foo"), typeof(string))); - Behaves_like yes; - } - - public class when_assert_is_not_instance_of_type_fails : assert_provider_context - { - Because of = () => Try(() => provider.IsNotInstanceOfType(new Foo("foo"), typeof(Foo))); - Behaves_like> yes; - } -<<<<<<< local - - [Behaviors] - public class Throws where T : AssertException - { - protected static Exception exception; - - It should_throw_assert_exception_of_expected_type = () => - { - Assert.IsNotNull(exception, "Expected an exception to be thrown but it was not."); - Assert.IsInstanceOfType(typeof(T), exception); - }; - } - - [Behaviors] - public class DoesNotThrow - { - protected static Exception exception; - It should_throw_not_equal_exception = () => Assert.IsNull(exception); - } -======= ->>>>>>> other -} \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/ShouldDateTimeSpecs.cs b/src/Should.Fluent.UnitTests/ShouldDateTimeSpecs.cs index 0e34636..fc9e0b7 100644 --- a/src/Should.Fluent.UnitTests/ShouldDateTimeSpecs.cs +++ b/src/Should.Fluent.UnitTests/ShouldDateTimeSpecs.cs @@ -1,6 +1,6 @@ using System; using Machine.Specifications; -using NUnit.Framework; +using Xunit; using Should.Core; using Should.Fluent.Model; @@ -23,28 +23,28 @@ public class should_datetime_mocked_context : test_base public class when_calling_datetime_equal_with_tolerance : should_datetime_mocked_context { Because of = () => result = should.Equal(expected, tolerance); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_assert_areequal = () => Called(x => x.AreEqual(expected, target, tolerance)); } public class when_calling_datetime_not_equal_with_tolerance : should_datetime_mocked_context { Because of = () => result = should.Not.Equal(expected, tolerance); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_assert_areequal = () => Called(x => x.AreNotEqual(expected, target, tolerance)); } public class when_calling_datetime_equal_with_precision : should_datetime_mocked_context { Because of = () => result = should.Equal(expected, precision); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_assert_areequal = () => Called(x => x.AreEqual(expected, target, precision)); } public class when_calling_datetime_with_not_equal_with_precision : should_datetime_mocked_context { Because of = () => result = should.Not.Equal(expected, precision); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_assert_areequal = () => Called(x => x.AreNotEqual(expected, target, precision)); } } \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/ShouldDictionarySpecs.cs b/src/Should.Fluent.UnitTests/ShouldDictionarySpecs.cs index d18cc27..622e542 100644 --- a/src/Should.Fluent.UnitTests/ShouldDictionarySpecs.cs +++ b/src/Should.Fluent.UnitTests/ShouldDictionarySpecs.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using Machine.Specifications; -using NUnit.Framework; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using Xunit; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { @@ -24,7 +24,7 @@ public class when_getting_count : should_dictionary_context Establish context = () => target.Add(1, 1); Because of = () => result = should.Count; - It count_should_not_be_null = () => Assert.IsNotNull(result); + It count_should_not_be_null = () => Assert.NotNull(result); } public class when_getting_contain : should_dictionary_context @@ -33,7 +33,7 @@ public class when_getting_contain : should_dictionary_context Establish context = () => target.Add(1, 1); Because of = () => result = should.Contain; - It contain_should_not_be_null = () => Assert.IsNotNull(result); + It contain_should_not_be_null = () => Assert.NotNull(result); } public class when_calling_contains_key : should_dictionary_context @@ -43,7 +43,7 @@ public class when_calling_contains_key : should_dictionary_context Establish context = () => target.Add(1, 1); Because of = () => result = should.ContainKey(1); It should_not_fail = NotFail; - It result_is_same_as_target = () => Assert.AreSame(target, result); + It result_is_same_as_target = () => Assert.Same(target, result); } public class when_calling_not_contains_key : should_dictionary_context @@ -53,7 +53,7 @@ public class when_calling_not_contains_key : should_dictionary_context Establish context = () => target.Add(1, 1); Because of = () => result = should.Not.ContainKey(2); It should_not_fail = NotFail; - It result_is_same_as_target = () => Assert.AreSame(target, result); + It result_is_same_as_target = () => Assert.Same(target, result); } public class when_calling_contains_key_but_not_contains : should_dictionary_context @@ -62,7 +62,7 @@ public class when_calling_contains_key_but_not_contains : should_dictionary_cont Establish context = () => target.Add(1, 1); Because of = () => result = should.ContainKey(2); - It result_is_same_as_target = () => Assert.AreSame(target, result); + It result_is_same_as_target = () => Assert.Same(target, result); It should_fail = () => Fail("Expected dictionary to contain key '{0}' but it does not.", 2); } } \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/ShouldDoubleSpecs.cs b/src/Should.Fluent.UnitTests/ShouldDoubleSpecs.cs index 63464b0..2502a85 100644 --- a/src/Should.Fluent.UnitTests/ShouldDoubleSpecs.cs +++ b/src/Should.Fluent.UnitTests/ShouldDoubleSpecs.cs @@ -1,6 +1,6 @@ using Machine.Specifications; -using NUnit.Framework; using Should.Fluent.Model; +using Xunit; namespace Should.Fluent.UnitTests { @@ -20,7 +20,7 @@ public class when_calling_double_equal : should_double_context const double expected = 5.001; const double tolerance = 0.001; Because of = () => result = should.Equal(expected, tolerance); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_assert_areequal = () => Called(x => x.AreEqual(expected, target, tolerance)); } @@ -29,7 +29,7 @@ public class when_calling_double_not_equal : should_double_context const double expected = 5.001; const double tolerance = 0.001; Because of = () => result = should.Not.Equal(expected, tolerance); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_assert_areequal = () => Called(x => x.AreNotEqual(expected, target, tolerance)); } } \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/ShouldExtensionsSpecs.cs b/src/Should.Fluent.UnitTests/ShouldExtensionsSpecs.cs index 01fc7ac..2cae44e 100644 --- a/src/Should.Fluent.UnitTests/ShouldExtensionsSpecs.cs +++ b/src/Should.Fluent.UnitTests/ShouldExtensionsSpecs.cs @@ -3,9 +3,8 @@ using System.ComponentModel; using System.Linq; using Machine.Specifications; -using NUnit.Framework; -using Should.Fluent.Model; -using It=Machine.Specifications.It; +using Xunit; +using It = Machine.Specifications.It; using IT = Moq.It; namespace Should.Fluent.UnitTests @@ -128,7 +127,7 @@ public class when_calling_string_should_be_covertable_to : mocked_assert_provide { var converter = TypeDescriptor.GetConverter(typeof(Guid)); var expected = (Guid)converter.ConvertFrom(actual); - Assert.AreEqual(result, expected); + Assert.Equal(result, expected); }; It should_not_fail = NotFail; } @@ -138,7 +137,7 @@ public class when_calling_string_should_not_be_covertable_to : mocked_assert_pro const string actual = "foo"; static int result; Because of = () => result = actual.Should().Not.Be.ConvertableTo(); - It result_is_default = () => Assert.AreEqual(result, 0); + It result_is_default = () => Assert.Equal(result, 0); It should_not_fail = NotFail; } } \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/ShouldSpecs.cs b/src/Should.Fluent.UnitTests/ShouldSpecs.cs index 3f0574f..bd00812 100644 --- a/src/Should.Fluent.UnitTests/ShouldSpecs.cs +++ b/src/Should.Fluent.UnitTests/ShouldSpecs.cs @@ -1,7 +1,7 @@ using Machine.Specifications; -using NUnit.Framework; using Should.Fluent.Model; -using It=Machine.Specifications.It; +using Xunit; +using It = Machine.Specifications.It; namespace Should.Fluent.UnitTests { @@ -20,15 +20,15 @@ public class when_calling_equal : should_context { const string expected = "foo"; Because of = () => result = should.Equal(expected); - It result_should_equal_target = () => Assert.AreEqual(target, result); - It should_assert_areequal = () => Called(x => x.AreEqual(expected, target)); + It result_should_equal_target = () => Assert.Equal(target, result); + It should_assert_Equal = () => Called(x => x.AreEqual(expected, target)); } public class when_calling_not_equal : should_context { const string expected = "bar"; Because of = () => result = should.Not.Equal(expected); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_assert_arenotequal = () => Called(x => x.AreNotEqual(expected, target)); } @@ -44,7 +44,7 @@ public class when_calling_starts_with : should_string_context { const string expected = "f"; Because of = () => result = should.StartWith(expected); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_not_fail = NotFail; } @@ -59,7 +59,7 @@ public class when_calling_not_starts_with : should_string_context { const string expected = "x"; Because of = () => result = should.Not.StartWith(expected); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_not_fail = NotFail; } @@ -74,7 +74,7 @@ public class when_calling_end_with : should_string_context { const string expected = "o"; Because of = () => result = should.EndWith(expected); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_not_fail = NotFail; } @@ -89,7 +89,7 @@ public class when_calling_not_ends_with : should_string_context { const string expected = "x"; Because of = () => result = should.Not.EndWith(expected); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_not_fail = NotFail; } @@ -105,7 +105,7 @@ public class when_calling_contain : should_string_context const string expected = "oo"; Because of = () => result = should.Contain(expected); It should_assert_issubstringof = () => Called(x => x.IsSubstringOf(target, expected)); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_not_fail = NotFail; } @@ -114,7 +114,7 @@ public class when_calling_not_contain : should_string_context protected static string expected = "x"; Because of = () => result = should.Not.Contain(expected); It should_not_assert_issubstringof = () => NotCalled(x => x.IsSubstringOf(target, expected)); - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); It should_not_fail = NotFail; } diff --git a/src/Should.Fluent.UnitTests/TestBase.cs b/src/Should.Fluent.UnitTests/TestBase.cs index 10c7f11..0d4381c 100644 --- a/src/Should.Fluent.UnitTests/TestBase.cs +++ b/src/Should.Fluent.UnitTests/TestBase.cs @@ -2,7 +2,7 @@ using System.Linq.Expressions; using Machine.Specifications; using Moq; -using NUnit.Framework; +using Xunit; using IT = Moq.It; //NOTE: Explcitly call methods on ShouldExtensions to prevent collisions with m-spec extension methods @@ -61,12 +61,12 @@ public class test_base : test_base protected static void VerifyResultType() { - Assert.IsInstanceOfType(typeof(TExpetected), result); + Assert.IsType(result); } protected static void VerifyResult(object actual) { - Assert.AreEqual(actual, result); + Assert.Equal(actual, result); } } diff --git a/src/Should.Fluent.UnitTests/packages.config b/src/Should.Fluent.UnitTests/packages.config deleted file mode 100644 index daefe31..0000000 --- a/src/Should.Fluent.UnitTests/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/Should.Fluent.UnitTests/result_should_be_target.cs b/src/Should.Fluent.UnitTests/result_should_be_target.cs index baff2b4..0a27c87 100644 --- a/src/Should.Fluent.UnitTests/result_should_be_target.cs +++ b/src/Should.Fluent.UnitTests/result_should_be_target.cs @@ -1,5 +1,5 @@ using Machine.Specifications; -using NUnit.Framework; +using Xunit; namespace Should.Fluent.UnitTests { @@ -8,6 +8,6 @@ public class result_should_be_target { protected static T result; protected static T target; - It result_should_equal_target = () => Assert.AreEqual(target, result); + It result_should_equal_target = () => Assert.Equal(target, result); } } \ No newline at end of file diff --git a/src/Should.Fluent/IAssertProvider.cs.orig b/src/Should.Fluent/IAssertProvider.cs.orig deleted file mode 100644 index a57749b..0000000 --- a/src/Should.Fluent/IAssertProvider.cs.orig +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using Should.Core; - -namespace Should.Fluent -{ - public interface IAssertProvider - { - void AreEqual(object expected, object actual); - void AreNotEqual(object expected, object actual); - void AreEqual(double expected, double actual, double tolerance); - void AreNotEqual(double expected, double actual, double tolerance); - void AreEqual(DateTime expected, DateTime actual, TimeSpan tolerance); - void AreNotEqual(DateTime expected, DateTime actual, TimeSpan tolerance); - void AreEqual(DateTime expected, DateTime actual, DatePrecision precision); - void AreNotEqual(DateTime expected, DateTime actual, DatePrecision precision); - void IsNotNull(object value); - void IsNull(object value); - void IsFalse(bool value); - void IsTrue(bool value); - void Fail(string messageFormat, params object[] args); - void Contains(T item, IEnumerable enumerable); - void NotContains(T item, IEnumerable enumerable); -<<<<<<< local - void Greater(double left, double right); - void GreaterOrEqual(double left, double right); - void Less(double i, double target); - void LessOrEqual(double i, double target); -======= - void GreaterThan(T left, T right); - void GreaterThan(T left, T right, IComparer comparer); - void GreaterThanOrEqual(T left, T right); - void GreaterThanOrEqual(T left, T right, IComparer comparer); - void LessThan(T left, T right); - void LessThan(T left, T right, IComparer comparer); - void LessThanOrEqual(T left, T right); - void LessThanOrEqual(T left, T right, IComparer comparer); ->>>>>>> other - void AreSame(object expected, object actual); - void AreNotSame(object expected, object actual); - void IsSubstringOf(string actual, string expectedSubstring); - void IsInstanceOfType(object actual, Type expectedType); - void IsNotInstanceOfType(object actual, Type expectedType); - void InRange(T target, T low, T high); - void NotInRange(T target, T low, T high); - void AssignableFrom(T target, Type expectedType); - void NotAssignableFrom(T target, Type expectedType); - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/BeBool.cs b/src/Should.Fluent/Model/BeBool.cs deleted file mode 100644 index 033b69d..0000000 --- a/src/Should.Fluent/Model/BeBool.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace Should.Fluent.Model -{ - public class BeBool - { - private readonly Should should; - private readonly IAssertProvider assertProvider; - - public BeBool(Should should, IAssertProvider assertProvider) - { - this.should = should; - this.assertProvider = assertProvider; - } - - public bool True() - { - if (should.Negate) - { - assertProvider.IsFalse(should.Target); - } - else - { - assertProvider.IsTrue(should.Target); - } - return should.Target; - } - - public bool False() - { - if (should.Negate) - { - assertProvider.IsTrue(should.Target); - } - else - { - assertProvider.IsFalse(should.Target); - } - return should.Target; - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/BeCollection.cs b/src/Should.Fluent/Model/BeCollection.cs deleted file mode 100644 index 32ab1a0..0000000 --- a/src/Should.Fluent/Model/BeCollection.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System.Collections; - -namespace Should.Fluent.Model -{ - public class BeCollection - { - private readonly ShouldCollection should; - private readonly IAssertProvider assertProvider; - - public BeCollection(ShouldCollection should, IAssertProvider assertProvider) - { - this.should = should; - this.assertProvider = assertProvider; - } - - public ICollection Empty() - { - if (should.Negate) - { - assertProvider.AreNotEqual(0, should.Target.Count); - } - else - { - assertProvider.AreEqual(0, should.Target.Count); - } - return should.Target; - } - - public ICollection Null() - { - return Check.IsNull(should, assertProvider); - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/BeDateTime.cs b/src/Should.Fluent/Model/BeDateTime.cs deleted file mode 100644 index f95ea40..0000000 --- a/src/Should.Fluent/Model/BeDateTime.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -namespace Should.Fluent.Model -{ - public class BeDateTime - { - private readonly ShouldDateTime should; - private readonly IAssertProvider assertProvider; - - public BeDateTime(ShouldDateTime should, IAssertProvider assertProvider) - { - this.should = should; - this.assertProvider = assertProvider; - } - - public DateTime Today() - { - if (should.Negate) - { - assertProvider.AreNotEqual(DateTime.Today, should.Target.Date); - } - else - { - assertProvider.AreEqual(DateTime.Today, should.Target.Date); - } - return should.Target; - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/BeDecimal.cs b/src/Should.Fluent/Model/BeDecimal.cs deleted file mode 100644 index e388e7f..0000000 --- a/src/Should.Fluent/Model/BeDecimal.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace Should.Fluent.Model -{ - public class BeDouble - { - private readonly ShouldDouble should; - private readonly IAssertProvider assertProvider; - - public BeDouble(ShouldDouble should, IAssertProvider assertProvider) - { - this.should = should; - this.assertProvider = assertProvider; - } - - public double Positive() - { - if (should.Negate) - { - assertProvider.LessOrEqual(0, should.Target); - } - else - { - assertProvider.Greater(0, should.Target); - } - return should.Target; - } - - public double Negative() - { - if (should.Negate) - { - assertProvider.GreaterOrEqual(0, should.Target); - } - else - { - assertProvider.Less(0, should.Target); - } - return should.Target; - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/BeEnumerable.cs b/src/Should.Fluent/Model/BeEnumerable.cs deleted file mode 100644 index fef1afa..0000000 --- a/src/Should.Fluent/Model/BeEnumerable.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; -using System.Linq; - -namespace Should.Fluent.Model -{ - public class BeEnumerable - { - private readonly ShouldEnumerable should; - private readonly IAssertProvider assertProvider; - - public BeEnumerable(ShouldEnumerable should, IAssertProvider assertProvider) - { - this.should = should; - this.assertProvider = assertProvider; - } - - public IEnumerable Empty() - { - if (should.Negate) - { - assertProvider.AreNotEqual(0, should.Target.Count()); - } - else - { - assertProvider.AreEqual(0, should.Target.Count()); - } - return should.Target; - } - - public IEnumerable Null() - { - return Check.IsNull(should, assertProvider); - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/BeGuid.cs b/src/Should.Fluent/Model/BeGuid.cs deleted file mode 100644 index 8e0c395..0000000 --- a/src/Should.Fluent/Model/BeGuid.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; - -namespace Should.Fluent.Model -{ - public class BeGuid - { - private readonly Should should; - private readonly IAssertProvider assertProvider; - - public BeGuid(Should should, IAssertProvider assertProvider) - { - this.should = should; - this.assertProvider = assertProvider; - } - - public Guid Empty() - { - if (should.Negate) - { - assertProvider.AreNotEqual(Guid.Empty, should.Target); - } - else - { - assertProvider.AreEqual(Guid.Empty, should.Target); - } - return should.Target; - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/BeNullableBool.cs b/src/Should.Fluent/Model/BeNullableBool.cs deleted file mode 100644 index 7ab5e67..0000000 --- a/src/Should.Fluent/Model/BeNullableBool.cs +++ /dev/null @@ -1,59 +0,0 @@ -namespace Should.Fluent.Model -{ - public class BeNullableBool - { - private readonly Should should; - private readonly IAssertProvider assertProvider; - - public BeNullableBool(Should should, IAssertProvider assertProvider) - { - this.should = should; - this.assertProvider = assertProvider; - } - - public bool? Null() - { - return Check.IsNull(should, assertProvider); - } - - public bool? True() - { - if (!should.Target.HasValue) - { - assertProvider.Fail("Expected TRUE but was NULL."); - } - else - { - if (should.Negate) - { - assertProvider.IsFalse(should.Target.Value); - } - else - { - assertProvider.IsTrue(should.Target.Value); - } - } - return should.Target; - } - - public bool? False() - { - if (!should.Target.HasValue) - { - assertProvider.Fail("Expected FALSE but was NULL."); - } - else - { - if (should.Negate) - { - assertProvider.IsTrue(should.Target.Value); - } - else - { - assertProvider.IsFalse(should.Target.Value); - } - } - return should.Target; - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/BeNullableDateTime.cs b/src/Should.Fluent/Model/BeNullableDateTime.cs deleted file mode 100644 index 21eb6d1..0000000 --- a/src/Should.Fluent/Model/BeNullableDateTime.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; - -namespace Should.Fluent.Model -{ - public class BeNullableDateTime - { - private readonly Should should; - private readonly IAssertProvider assertProvider; - - public BeNullableDateTime(Should should, IAssertProvider assertProvider) - { - this.should = should; - this.assertProvider = assertProvider; - } - - public DateTime? Null() - { - return Check.IsNull(should, assertProvider); - } - - public DateTime? Today() - { - if (!should.Target.HasValue) - { - assertProvider.Fail("Expected TODAY but was NULL."); - } - else - { - if (should.Negate) - { - assertProvider.AreNotEqual(DateTime.Today, should.Target.Value.Date); - } - else - { - assertProvider.AreEqual(DateTime.Today, should.Target.Value.Date); - } - } - return should.Target; - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/BeString.cs b/src/Should.Fluent/Model/BeString.cs deleted file mode 100644 index 57e2eb4..0000000 --- a/src/Should.Fluent/Model/BeString.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.ComponentModel; - -namespace Should.Fluent.Model -{ - public class BeString - { - private readonly ShouldString should; - private readonly IAssertProvider assertProvider; - - public BeString(ShouldString should, IAssertProvider assertProvider) - { - this.should = should; - this.assertProvider = assertProvider; - } - - public string Null() - { - return Check.IsNull(should, assertProvider); - } - - public string Empty() - { - if (should.Negate) - { - assertProvider.AreNotEqual(string.Empty, should.Target); - } - else - { - assertProvider.AreEqual(string.Empty, should.Target); - } - return should.Target; - } - - public string NullOrEmpty() - { - var targetNullOrEmpty = string.IsNullOrEmpty(should.Target); - if (should.Negate) - { - assertProvider.IsFalse(targetNullOrEmpty); - } - else - { - assertProvider.IsTrue(targetNullOrEmpty); - } - return should.Target; - } - - public T ConvertableTo() - { - if (should.Negate) - { - try - { - TypeDescriptor.GetConverter(typeof(T)); - assertProvider.Fail("Could convert '{0}' to {1}. Expected not covertable.", should.Target, typeof(T)); - } - catch { } - } - else - { - try - { - var converter = TypeDescriptor.GetConverter(typeof(T)); - return (T)converter.ConvertFrom(should.Target); - } - catch (Exception ex) - { - assertProvider.Fail("Could not convert '{0}' to {1}. {3}", should.Target, typeof(T), ex.ToString()); - } - } - return default(T); - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/ShouldDateTime.cs b/src/Should.Fluent/Model/ShouldDateTime.cs deleted file mode 100644 index f94c772..0000000 --- a/src/Should.Fluent/Model/ShouldDateTime.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using Should.Core; - -namespace Should.Fluent.Model -{ - public class ShouldDateTime : ShouldBase - { - public ShouldDateTime(DateTime target, IAssertProvider assertProvider) : base(target, assertProvider) { } - - public DateTime Equal(DateTime expected, TimeSpan tolerance) - { - if (Negate) - { - assertProvider.AreNotEqual(expected, Target, tolerance); - } - else - { - assertProvider.AreEqual(expected, Target, tolerance); - } - return Target; - } - - public DateTime Equal(DateTime expected, DatePrecision precision) - { - if (Negate) - { - assertProvider.AreNotEqual(expected, Target, precision); - } - else - { - assertProvider.AreEqual(expected, Target, precision); - } - return Target; - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/ShouldDouble.cs b/src/Should.Fluent/Model/ShouldDouble.cs deleted file mode 100644 index a67e35a..0000000 --- a/src/Should.Fluent/Model/ShouldDouble.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Should.Fluent.Model -{ - public class ShouldDouble : ShouldBase - { - public ShouldDouble(double target, IAssertProvider assertProvider) : base(target, assertProvider) { } - - public double Equal(double expected, double tolerance) - { - if (Negate) - { - assertProvider.AreNotEqual(expected, Target, tolerance); - } - else - { - assertProvider.AreEqual(expected, Target, tolerance); - } - return Target; - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Model/ShouldString.cs b/src/Should.Fluent/Model/ShouldString.cs deleted file mode 100644 index 87d829e..0000000 --- a/src/Should.Fluent/Model/ShouldString.cs +++ /dev/null @@ -1,61 +0,0 @@ -namespace Should.Fluent.Model -{ - public class ShouldString : ShouldBase - { - public ShouldString(string target, IAssertProvider assertProvider) : base(target, assertProvider) { } - - public string Contain(string expectedSubstring) - { - if (Negate) - { - if (Target.Contains(expectedSubstring)) - { - assertProvider.Fail("Expected string '{0}' to not contain '{1}', but it did.", Target, expectedSubstring); - } - } - else - { - assertProvider.IsSubstringOf(Target, expectedSubstring); - } - return Target; - } - - public string StartWith(string expectedSubstring) - { - if (Negate) - { - if (Target.StartsWith(expectedSubstring)) - { - assertProvider.Fail("Expected string '{0}' to not start with '{1}', but it did.", Target, expectedSubstring); - } - } - else - { - if (!Target.StartsWith(expectedSubstring)) - { - assertProvider.Fail("Expected string '{0}' to start with '{1}', but it did not.", Target, expectedSubstring); - } - } - return Target; - } - - public string EndWith(string expectedSubstring) - { - if (Negate) - { - if (Target.EndsWith(expectedSubstring)) - { - assertProvider.Fail("Expected string '{0}' to not end with '{1}', but it did.", Target, expectedSubstring); - } - } - else - { - if (!Target.EndsWith(expectedSubstring)) - { - assertProvider.Fail("Expected string '{0}' to end with '{1}', but it did not.", Target, expectedSubstring); - } - } - return Target; - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/Should.Fluent.csproj b/src/Should.Fluent/Should.Fluent.csproj index 1bde6a6..64e5380 100644 --- a/src/Should.Fluent/Should.Fluent.csproj +++ b/src/Should.Fluent/Should.Fluent.csproj @@ -1,104 +1,8 @@ - - + - Debug - AnyCPU - 9.0.30729 - 2.0 - {20743DBF-AEF5-464B-9C9B-8109AD43AA5A} - Library - Properties - Should.Fluent - Should.Fluent - v3.5 - 512 - - - 3.5 - + netcoreapp2.2 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - - - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Should.Fluent.xml - - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {984764C1-D102-43AD-8DE9-0AA3B7E5D431} - Should.Core - + - - \ No newline at end of file diff --git a/src/Should.Fluent/Should.Fluent.csproj.orig b/src/Should.Fluent/Should.Fluent.csproj.orig deleted file mode 100644 index af26077..0000000 --- a/src/Should.Fluent/Should.Fluent.csproj.orig +++ /dev/null @@ -1,107 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {20743DBF-AEF5-464B-9C9B-8109AD43AA5A} - Library - Properties - Should.Fluent - Should.Fluent - v3.5 - 512 - - - 3.5 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - - - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Should.Fluent.xml - - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - Properties\CommonAssemblyInfo.cs - -<<<<<<< local - - - -======= - - - - - - - - - - - ->>>>>>> other - - - - - - - - - - - - - - - - - - - {984764C1-D102-43AD-8DE9-0AA3B7E5D431} - Should.Core - - - - - \ No newline at end of file diff --git a/src/Should.Fluent/ShouldCoreAssertProvider.cs.orig b/src/Should.Fluent/ShouldCoreAssertProvider.cs.orig deleted file mode 100644 index 39602a1..0000000 --- a/src/Should.Fluent/ShouldCoreAssertProvider.cs.orig +++ /dev/null @@ -1,233 +0,0 @@ -using System; -using System.Collections.Generic; -using Should.Core; -using Should.Core.Assertions; -using Should.Core.Exceptions; - -namespace Should.Fluent -{ - public class ShouldCoreAssertProvider : IAssertProvider - { - public void AreEqual(object expected, object actual) - { - Assert.Equal(expected, actual); - } - - public void AreNotEqual(object expected, object actual) - { - Assert.NotEqual(expected, actual); - } - -<<<<<<< local - public void AreEqual(double expected, double actual, double tolerance) -======= - public void GreaterThan(T left, T right) ->>>>>>> other - { -<<<<<<< local - Assert.Equal(expected, actual, tolerance); -======= - Assert.GreaterThan(left, right); ->>>>>>> other - } - -<<<<<<< local - public void AreNotEqual(double expected, double actual, double tolerance) -======= - public void GreaterThan(T left, T right, IComparer comparer) ->>>>>>> other - { -<<<<<<< local - Assert.NotEqual(expected, actual, tolerance); -======= - Assert.GreaterThan(left, right, comparer); ->>>>>>> other - } - -<<<<<<< local - public void AreEqual(DateTime expected, DateTime actual, TimeSpan tolerance) -======= - public void GreaterThanOrEqual(T left, T right) ->>>>>>> other - { -<<<<<<< local - Assert.Equal(expected, actual, tolerance); -======= - Assert.GreaterThanOrEqual(left, right); ->>>>>>> other - } - -<<<<<<< local - public void AreNotEqual(DateTime expected, DateTime actual, TimeSpan tolerance) -======= - public void GreaterThanOrEqual(T left, T right, IComparer comparer) ->>>>>>> other - { -<<<<<<< local - Assert.NotEqual(expected, actual, tolerance); -======= - Assert.GreaterThanOrEqual(left, right, comparer); ->>>>>>> other - } - -<<<<<<< local - public void AreEqual(DateTime expected, DateTime actual, DatePrecision precision) -======= - public void LessThan(T left, T right) ->>>>>>> other - { -<<<<<<< local - Assert.Equal(expected, actual, precision); -======= - Assert.LessThan(left, right); ->>>>>>> other - } - -<<<<<<< local - public void AreNotEqual(DateTime expected, DateTime actual, DatePrecision precision) -======= - public void LessThan(T left, T right, IComparer comparer) ->>>>>>> other - { -<<<<<<< local - Assert.NotEqual(expected, actual, precision); -======= - Assert.LessThan(left, right, comparer); ->>>>>>> other - } - -<<<<<<< local -======= - public void LessThanOrEqual(T left, T right) - { - Assert.LessThanOrEqual(left, right); - } - - public void LessThanOrEqual(T left, T right, IComparer comparer) - { - Assert.LessThanOrEqual(left, right, comparer); - } - ->>>>>>> other - public void IsNotNull(object value) - { - Assert.NotNull(value); - } - - public void IsNull(object value) - { - Assert.Null(value); - } - - public void IsFalse(bool value) - { - Assert.False(value); - } - - public void IsTrue(bool value) - { - Assert.True(value); - } - - public void Fail(string messageFormat, params object[] args) - { - args = args ?? new object[0]; - throw new AssertException(string.Format(messageFormat, args)); - } - - public void Contains(T item, IEnumerable enumerable) - { - Assert.Contains(item, enumerable); - } - - public void NotContains(T item, IEnumerable enumerable) - { - Assert.DoesNotContain(item, enumerable); - } - -<<<<<<< local - public void Greater(double left, double right) - { - if (!(left > right)) - { - throw new AssertException(string.Format("Expected {0} to be greater than {1}.", left, right)); - } - } - - public void GreaterOrEqual(double left, double right) - { - if (!(left >= right)) - { - throw new AssertException(string.Format("Expected {0} to be greater than or equal to {1}.", left, right)); - } - } - - public void Less(double left, double right) - { - if (!(left < right)) - { - throw new AssertException(string.Format("Expected {0} to be greater than {1}.", left, right)); - } - } - - public void LessOrEqual(double left, double right) - { - if (!(left <= right)) - { - throw new AssertException(string.Format("Expected {0} to be greater than or equal to {1}.", left, right)); - } - } - -======= ->>>>>>> other - public void AreSame(object expected, object actual) - { - Assert.Same(expected, actual); - } - - public void AreNotSame(object expected, object actual) - { - Assert.NotSame(expected, actual); - } - - public void IsSubstringOf(string actual, string expectedSubstring) - { - Assert.Contains(expectedSubstring, actual); - } - - public void IsInstanceOfType(object actual, Type expectedType) - { - Assert.IsType(expectedType, actual); - } - - public void IsNotInstanceOfType(object actual, Type expectedType) - { - Assert.IsNotType(expectedType, actual); - } - - public void InRange(T target, T low, T high) - { - Assert.InRange(target, low, high); - } - - public void NotInRange(T target, T low, T high) - { - Assert.NotInRange(target, low, high); - } - - public void AssignableFrom(T target, Type expectedType) - { - Assert.IsAssignableFrom(expectedType, target); - } - - public void NotAssignableFrom(T target, Type expectedType) - { - try - { - Assert.IsAssignableFrom(expectedType, target); - throw new AssertException(string.Format("Expected {0} to NOT be assignable from {1}, but it is.", target.GetType(), expectedType)); - } - catch (IsAssignableFromException) { } - } - } -} \ No newline at end of file diff --git a/src/Should.Fluent/ShouldExtensions.cs.orig b/src/Should.Fluent/ShouldExtensions.cs.orig deleted file mode 100644 index b79779b..0000000 --- a/src/Should.Fluent/ShouldExtensions.cs.orig +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using Should.Fluent.Model; - -namespace Should.Fluent -{ - public static class ShouldExtensions - { - private static readonly IAssertProvider defaultAssertProvider; - - static ShouldExtensions() - { - defaultAssertProvider = new ShouldCoreAssertProvider(); - AssertProvider = defaultAssertProvider; - } - - public static IAssertProvider AssertProvider { get; set; } - - public static void ResetAssertProvider() - { - AssertProvider = defaultAssertProvider; - } - - public static Should> Should(this object o) - { - return new Should>(o, AssertProvider); - } - - //TODO: This overload will only be chosen when both generic params are specified. This is because constraints are not used in overload resolution. Find some way to provide an overload that will strongly types the target when it is of a type not specifically covered by another overload. - public static Should> Should(this U o) where U : T - { - return new Should>(o, AssertProvider); - } - - public static ShouldEnumerable Should(this IEnumerable e) - { - return new ShouldEnumerable(e, AssertProvider); - } - - public static ShouldDictionary Should(this IEnumerable> d) - { - return new ShouldDictionary(d, AssertProvider); - } - - public static Should> Should(this bool b) - { - return new Should>(b, AssertProvider); - } - - public static Should> Should(this bool? b) - { - return new Should>(b, AssertProvider); - } - -<<<<<<< local - public static ShouldDateTime Should(this DateTime d) -======= - public static Should> Should(this DateTime d) ->>>>>>> other - { -<<<<<<< local - return new ShouldDateTime(d, AssertProvider); -======= - return new Should>(d, AssertProvider); ->>>>>>> other - } - - public static Should> Should(this DateTime? d) - { - return new Should>(d, AssertProvider); - } - - public static Should> Should(this string s) - { - return new Should>(s, AssertProvider); - } - -<<<<<<< local - public static ShouldDouble Should(this double s) - { - return new ShouldDouble(s, AssertProvider); - } - - public static Should Should(this Guid g) -======= - public static Should> Should(this Guid g) ->>>>>>> other - { - return new Should>(g, AssertProvider); - } - } -} \ No newline at end of file diff --git a/src/Should.sln b/src/Should.sln index 4eeed98..84eacd1 100644 --- a/src/Should.sln +++ b/src/Should.sln @@ -1,18 +1,17 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{724F85B0-4E93-46D4-AD51-D04C54139498}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Should", "should\Should.csproj", "{5606A23D-EBDA-4563-B303-F19CEFE9EC32}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Should.Fluent", "Should.Fluent\Should.Fluent.csproj", "{20743DBF-AEF5-464B-9C9B-8109AD43AA5A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Should.Fluent.UnitTests", "Should.Fluent.UnitTests\Should.Fluent.UnitTests.csproj", "{A2973D4C-660C-42C8-A610-3B69170B6932}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Should.Core", "Should.Core\Should.Core.csproj", "{984764C1-D102-43AD-8DE9-0AA3B7E5D431}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Should.Facts", "should.Facts\Should.Facts.csproj", "{9C18BFAC-56DB-43BD-A6D2-1DDB19286961}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Should.Fluent.UnitTests", "Should.Fluent.UnitTests\Should.Fluent.UnitTests.csproj", "{3071F403-3A22-4048-9DFE-9CA2FAE8DB8E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,10 +26,6 @@ Global {20743DBF-AEF5-464B-9C9B-8109AD43AA5A}.Debug|Any CPU.Build.0 = Debug|Any CPU {20743DBF-AEF5-464B-9C9B-8109AD43AA5A}.Release|Any CPU.ActiveCfg = Release|Any CPU {20743DBF-AEF5-464B-9C9B-8109AD43AA5A}.Release|Any CPU.Build.0 = Release|Any CPU - {A2973D4C-660C-42C8-A610-3B69170B6932}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A2973D4C-660C-42C8-A610-3B69170B6932}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A2973D4C-660C-42C8-A610-3B69170B6932}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A2973D4C-660C-42C8-A610-3B69170B6932}.Release|Any CPU.Build.0 = Release|Any CPU {984764C1-D102-43AD-8DE9-0AA3B7E5D431}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {984764C1-D102-43AD-8DE9-0AA3B7E5D431}.Debug|Any CPU.Build.0 = Debug|Any CPU {984764C1-D102-43AD-8DE9-0AA3B7E5D431}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -39,12 +34,16 @@ Global {9C18BFAC-56DB-43BD-A6D2-1DDB19286961}.Debug|Any CPU.Build.0 = Debug|Any CPU {9C18BFAC-56DB-43BD-A6D2-1DDB19286961}.Release|Any CPU.ActiveCfg = Release|Any CPU {9C18BFAC-56DB-43BD-A6D2-1DDB19286961}.Release|Any CPU.Build.0 = Release|Any CPU + {3071F403-3A22-4048-9DFE-9CA2FAE8DB8E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3071F403-3A22-4048-9DFE-9CA2FAE8DB8E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3071F403-3A22-4048-9DFE-9CA2FAE8DB8E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3071F403-3A22-4048-9DFE-9CA2FAE8DB8E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {A2973D4C-660C-42C8-A610-3B69170B6932} = {724F85B0-4E93-46D4-AD51-D04C54139498} {9C18BFAC-56DB-43BD-A6D2-1DDB19286961} = {724F85B0-4E93-46D4-AD51-D04C54139498} + {3071F403-3A22-4048-9DFE-9CA2FAE8DB8E} = {724F85B0-4E93-46D4-AD51-D04C54139498} EndGlobalSection EndGlobal diff --git a/src/Should.sln.cache b/src/Should.sln.cache deleted file mode 100644 index b40e910..0000000 --- a/src/Should.sln.cache +++ /dev/null @@ -1,287 +0,0 @@ - - - <_SolutionProjectConfiguration>Release|Any CPU - <_SolutionProjectToolsVersion>3.5 - <_SolutionProjectCacheVersion>3.5 - - - <_SolutionProjectProjects Include="Should.Core\Should.Core.csproj" /> - <_SolutionProjectProjects Include="should.Facts\Should.Facts.csproj" /> - <_SolutionProjectProjects Include="Should.Fluent.UnitTests\Should.Fluent.UnitTests.csproj" /> - <_SolutionProjectProjects Include="Should.Fluent\Should.Fluent.csproj" /> - <_SolutionProjectProjects Include="should\Should.csproj" /> - - - - Debug - AnyCPU - - - Debug - AnyCPU - - - Debug - AnyCPU - - - Debug - AnyCPU - - - Debug - AnyCPU - - - - - Release - AnyCPU - - - Release - AnyCPU - - - Release - AnyCPU - - - Release - AnyCPU - - - Release - AnyCPU - - - - - - Debug - - - Any CPU - - - $(Configuration) - - - C:\Sandbox\oss\Should\src\ - .sln - Should.sln - Should - C:\Sandbox\oss\Should\src\Should.sln - - - v2.0 - v3.5 - - - - - Debug|AnyCPU - Debug|AnyCPU - Debug|AnyCPU - Debug|AnyCPU - Debug|AnyCPU - - - - - - - Release|AnyCPU - Release|AnyCPU - Release|AnyCPU - Release|AnyCPU - Release|AnyCPU - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/nuget.config b/src/nuget.config deleted file mode 100644 index 1d3dc88..0000000 Binary files a/src/nuget.config and /dev/null differ diff --git a/src/should.Facts/ActionAssertionExtension_Facts.cs b/src/should.Facts/ActionAssertionExtension_Facts.cs index a569f86..998edc1 100644 --- a/src/should.Facts/ActionAssertionExtension_Facts.cs +++ b/src/should.Facts/ActionAssertionExtension_Facts.cs @@ -21,8 +21,7 @@ public void ShouldThrow_passes_if_expected_exception_is_thrown() public void ShouldThrow_fails_if_a_different_exception_is_thrown() { Action action = () => ThrowMethod(); - Assert.Throws( - typeof(Should.Core.Exceptions.ThrowsException), + Assert.Throws( () => action.ShouldThrow()); } } diff --git a/src/should.Facts/Core/RecordTests.cs b/src/should.Facts/Core/RecordTests.cs index afa2aa4..94119e1 100644 --- a/src/should.Facts/Core/RecordTests.cs +++ b/src/should.Facts/Core/RecordTests.cs @@ -11,7 +11,7 @@ public class MethodsWithoutReturnValues [Fact] public void Exception() { - Exception ex = Record.Exception(delegate { throw new InvalidOperationException(); }); + Exception ex = Record.ExceptionAsync(() => throw new InvalidOperationException()).Result; Assert.NotNull(ex); Assert.IsType(ex); diff --git a/src/should.Facts/ObjectAssertionExtension_Facts.cs b/src/should.Facts/ObjectAssertionExtension_Facts.cs index c943f41..cd09bb4 100644 --- a/src/should.Facts/ObjectAssertionExtension_Facts.cs +++ b/src/should.Facts/ObjectAssertionExtension_Facts.cs @@ -17,7 +17,7 @@ public void ShouldNotBeNull_accepts_a_message_to_describe_failure() s.ShouldNotBeNull("custom failure message"); }); - Assert.Equal(ex.Message, "custom failure message"); + Assert.Equal("custom failure message", ex.Message); } [Fact] diff --git a/src/should.Facts/Should.Facts.csproj b/src/should.Facts/Should.Facts.csproj index 702e080..588cb49 100644 --- a/src/should.Facts/Should.Facts.csproj +++ b/src/should.Facts/Should.Facts.csproj @@ -1,121 +1,15 @@ - - + - Debug - AnyCPU - 9.0.30729 - 2.0 - {9C18BFAC-56DB-43BD-A6D2-1DDB19286961} - Library - Properties - Should.Facts - Should.Facts - v3.5 - 512 - - - 3.5 - + netcoreapp2.2 + false + false - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\..\lib\MOQ\Moq.dll - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - False - ..\..\lib\xunit.net\xunit.dll - - - False - ..\..\lib\xunit.net\xunit.extensions.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - {984764C1-D102-43AD-8DE9-0AA3B7E5D431} - Should.Core - - - {5606A23D-EBDA-4563-B303-F19CEFE9EC32} - Should - + + - - \ No newline at end of file diff --git a/src/should.Facts/Should.Facts.csproj.orig b/src/should.Facts/Should.Facts.csproj.orig deleted file mode 100644 index 746b464..0000000 --- a/src/should.Facts/Should.Facts.csproj.orig +++ /dev/null @@ -1,124 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {9C18BFAC-56DB-43BD-A6D2-1DDB19286961} - Library - Properties - Should.Facts - Should.Facts - v3.5 - 512 - - - 3.5 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - False - ..\..\lib\MOQ\Moq.dll - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - False - ..\..\lib\xunit.net\xunit.dll - - - False - ..\..\lib\xunit.net\xunit.extensions.dll - - - -<<<<<<< local - -======= - ->>>>>>> other - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {984764C1-D102-43AD-8DE9-0AA3B7E5D431} - Should.Core - - - {5606A23D-EBDA-4563-B303-F19CEFE9EC32} - Should - - - - - \ No newline at end of file diff --git a/src/should.Facts/TraceAssertTests.cs b/src/should.Facts/TraceAssertTests.cs deleted file mode 100644 index b0e7330..0000000 --- a/src/should.Facts/TraceAssertTests.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Diagnostics; -using Xunit; -using Xunit.Sdk; -using Assert = Should.Core.Assertions.Assert; - -namespace Should.Facts.Core -{ - public class TraceAssertTests - { - [Fact] - public void TraceAssertFailureWithFullDetails() - { - TraceAssertException ex = Assert.Throws(() => Trace.Assert(false, "message", "detailed message")); - - Assert.Equal("message", ex.AssertMessage); - Assert.Equal("detailed message", ex.AssertDetailedMessage); - Assert.Equal("Debug.Assert() Failure : message" + Environment.NewLine + "Detailed Message:" + Environment.NewLine + "detailed message", ex.Message); - } - - [Fact] - public void TraceAssertFailureWithNoDetailedMessage() - { - TraceAssertException ex = Assert.Throws(() => Trace.Assert(false, "message")); - - Assert.Equal("message", ex.AssertMessage); - Assert.Equal("", ex.AssertDetailedMessage); - Assert.Equal("Debug.Assert() Failure : message", ex.Message); - } - - [Fact] - public void TraceAssertFailureWithNoMessage() - { - TraceAssertException ex = Assert.Throws(() => Trace.Assert(false)); - - Assert.Equal("", ex.AssertMessage); - Assert.Equal("", ex.AssertDetailedMessage); - Assert.Equal("Debug.Assert() Failure", ex.Message); - } - } -} \ No newline at end of file diff --git a/src/should/Should.csproj b/src/should/Should.csproj index 9455722..b49e204 100644 --- a/src/should/Should.csproj +++ b/src/should/Should.csproj @@ -1,82 +1,16 @@ - - + - Debug - AnyCPU - 9.0.30729 - 2.0 - {5606A23D-EBDA-4563-B303-F19CEFE9EC32} - Library - Properties - Should - Should - v3.5 - 512 - - - 3.5 - + netcoreapp2.2 + 2.0.0 + Should Assertion Library + The Should Assertion Library provides a set of extension methods for test assertions for AAA and BDD style tests. It provides assertions only, and as a result it is Test runner agnostic. The assertions are a direct fork of the xUnit test assertions. This project was born because test runners Should be independent of the the assertions! + Copyright © Should Assertion Library 2007-2019 + https://github.com/erichexter/Should/ + https://github.com/erichexter/Should/blob/master/license.txt + https://github.com/erichexter/Should/ + GitHub - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - - - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Should.xml - - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - {984764C1-D102-43AD-8DE9-0AA3B7E5D431} - Should.Core - + - - \ No newline at end of file diff --git a/src/should/Should.csproj.orig b/src/should/Should.csproj.orig deleted file mode 100644 index f1a7267..0000000 --- a/src/should/Should.csproj.orig +++ /dev/null @@ -1,81 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {5606A23D-EBDA-4563-B303-F19CEFE9EC32} - Library - Properties - Should - Should - v3.5 - 512 - - - 3.5 - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - - - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - bin\Release\Should.xml - - - - - 3.5 - - - 3.5 - - - 3.5 - - - - - - - Properties\CommonAssemblyInfo.cs - - - - - - - - - - - {984764C1-D102-43AD-8DE9-0AA3B7E5D431} - Should.Core - - - - - \ No newline at end of file