GithubHelp home page GithubHelp logo

bbraithwaite / mstestextensions Goto Github PK

View Code? Open in Web Editor NEW
55.0 55.0 17.0 38 KB

An extendible implementation of the Assert class in MSTest. Allows for extending the Assert methods with the default MSTest methods as a default. Also includes a Throws() method for asserting exceptions.

C# 100.00%

mstestextensions's People

Contributors

allykzam avatar bbraithwaite avatar diegomartelli avatar knucklhead13 avatar milbrandt avatar tgfl-tom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mstestextensions's Issues

License?

I was looking around the 'net for a better way to deal with exceptions in MSTest and found the blog post on contentedcoder.com (and subsequently this project). So far it looks great, I've pulled it off NuGet and given it a quick try, and would like to use it for personal projects, but I can't find any licensing information.

So, is there a specific license this project is released under, and if there is, can that be reflected either by mentioning it in the AssemblyInfo files, or in a license file in the project root? Thanks in advance!

ExceptionAssert.Throws cannot be used on .NET 4.5 Async Tasks

The new async/await syntax is a very prominent feature of .NET 4.5, and I have found myself needing to Assert that async operations throw the correct sorts of exceptions.

With the current MSTestExtensions I cannot do the following:

ExceptionAssert.Throws<ArgumentNullException>(async () => await SampleArgumentNullException());

If methods that accepted Func instead of Action were implemented, this would be possible

Syntax to check a Using clause will 'throw'?

I am thinking this is likely my syntax error. How should I write correctly to assert that this will throw an exception?
Thank you for a great addition to our community!

            Assert.Throws(  ()=>
          using ( new Impersonator( "myUsername", "myDomainname", "myPassword" ) )
          {
              string a = 'a';
          }

p.s. I am getting the below, so probably I would prefer to test the string.

System.ComponentModel.Win32Exception: Logon failure: unknown user name or bad password

AnneTheAgile

Signing (strong name) and assembly version

Please sign (strong name) your assembly. Only strong named assembly are allowed as a dependency for other strong named projects.

Signing may also require a maintained version number. The current Nuget version seems to be 4.0.0 but the assembly version and file version are still 1.0.0.0. This could lead to unexpected bugs if someone puts them into the GAC.

Comparing strings using ToUpper instead of ignoring case

Hi, just wondering why you uppercase the exception message / expected message for doing string comparisons, rather than using (e.g.) StringComparison.CurrentCultureIgnoreCase?

The advantage of using the case-insensitive comparer is that if the assertion fails, the exception message doesn't yell at you ;-)

Nuget package will install in VS2010, but can't be used

MSTestExtensions doesn't seem to work when used in VS2010, apparently because it was compiled with .NET 4.5 as target framework. I have 4.5 installed, but VS2010 treats it as 4.0:

  • When including the assembly reference, I'm getting a warning about "MSTestExtensions, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL" targeting ".NETFramework,Version=v4.5" while the project targets ".NETFramework,Version=v4.0". (It says 1.0.0.0 even though Nuget downloaded 4.0.0?)
  • When actually trying to use it in code, I get an error about missing type or namespace "MSTestExtensions".

Exception Inheritance

Trying to work through some tests using Assert.Throws<T>, some of the tests are getting difficult to write due to certain exception types inheriting others. My specific issues are arising with ArgumentNullException and ArgumentOutOfRangeException, as both have ArgumentException in their inheritance hierarchy. Due to that, when I test for an ArgumentException, the assert passes even though the exception was a subtype.

Would it be possible to add a check along the lines of Assert.IsFalse(typeof(ex).IsSubclassOf(typeof(T))); around here, either as the default behavior or as an option similar to ExceptionMessageCompareOptions?

Would be happy to make the change myself and open a pull request depending on your contributor requirements, will likely just change it in a fork otherwise.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.