Last active
December 17, 2015 10:09
-
-
Save Karql/5592710 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
namespace MiniTestFramework | |
{ | |
public class SmallerAssertion : AssertionInteface | |
{ | |
public string Message { get { return "smaller"; } } | |
protected int value; | |
public SmallerAssertion(int v) | |
{ | |
this.value = v; | |
} | |
bool AssertionInteface.check(int sample) | |
{ | |
return ( sample < this.value ); | |
} | |
} | |
class MyTests : TestBase | |
{ | |
// załóżmy, że TestBase jest dllką i nie mamy dostępu a chcemy dodać nowa assercje | |
public AssertionInteface be_smaller(int v) | |
{ | |
return new SmallerAssertion(v); | |
} | |
public void test_equal() | |
{ | |
except(6).to(eq(6)); | |
} | |
public void test_equalfail() | |
{ | |
except(6).to(eq(7)); | |
} | |
public void test_beetwen() | |
{ | |
except(6).to(be_beetwen(3, 7)); | |
} | |
public void test_beetwenfail() | |
{ | |
except(6).not_to(be_beetwen(3, 7)); | |
} | |
public void test_smaller() | |
{ | |
except(6).to(be_smaller(8)); | |
} | |
public void test_smallerfail() | |
{ | |
except(9).to(be_smaller(8)); | |
} | |
} | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
MyTests tests = new MyTests(); | |
tests.RunTests(); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment