-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #74 from lundmikkel/master
Fixes IsStatic() extension method.
- Loading branch information
Showing
3 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
100 changes: 100 additions & 0 deletions
100
TestStack.ConventionTests.Tests/ConventionData/TypeExtensionsTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
namespace TestStack.ConventionTests.Tests.TestConventions | ||
{ | ||
using NUnit.Framework; | ||
|
||
using TestStack.ConventionTests.ConventionData; | ||
|
||
|
||
[TestFixture] | ||
public class TypeExtensionsTests | ||
{ | ||
#region IsStatic | ||
|
||
[Test] | ||
public void IsStatic_StaticClass_True() | ||
{ | ||
// Arrange | ||
var type = typeof(StaticClass); | ||
|
||
// Act | ||
var isStatic = type.IsStatic(); | ||
|
||
// Assert | ||
Assert.That(isStatic, Is.True); | ||
} | ||
|
||
[Test] | ||
public void IsStatic_SealedClass_False() | ||
{ | ||
// Arrange | ||
var type = typeof(SealedClass); | ||
|
||
// Act | ||
var isStatic = type.IsStatic(); | ||
|
||
// Assert | ||
Assert.That(isStatic, Is.False); | ||
} | ||
|
||
[Test] | ||
public void IsStatic_NonStaticClass_False() | ||
{ | ||
// Arrange | ||
var type = typeof(NonStaticClass); | ||
|
||
// Act | ||
var isStatic = type.IsStatic(); | ||
|
||
// Assert | ||
Assert.That(isStatic, Is.False); | ||
} | ||
|
||
[Test] | ||
public void IsStatic_AbstractClass_False() | ||
{ | ||
// Arrange | ||
var type = typeof(AbstractClass); | ||
|
||
// Act | ||
var isStatic = type.IsStatic(); | ||
|
||
// Assert | ||
Assert.That(isStatic, Is.False); | ||
} | ||
|
||
[Test] | ||
public void IsStatic_Interface_False() | ||
{ | ||
// Arrange | ||
var type = typeof(IInterface); | ||
|
||
// Act | ||
var isStatic = type.IsStatic(); | ||
|
||
// Assert | ||
Assert.That(isStatic, Is.False); | ||
} | ||
|
||
[Test] | ||
public void IsStatic_SimpleType_False() | ||
{ | ||
// Arrange | ||
var type = typeof(int); | ||
|
||
// Act | ||
var isStatic = type.IsStatic(); | ||
|
||
// Assert | ||
Assert.That(isStatic, Is.False); | ||
} | ||
|
||
|
||
private class NonStaticClass {} | ||
private sealed class SealedClass {} | ||
private static class StaticClass {} | ||
private abstract class AbstractClass {} | ||
private interface IInterface {} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters