- autp3_demo.zip
- Lib
- UnitTest.sln
- UnitTest.suo
- UnitTest
- UTCore
- UTExample
- UTWinForm
- App.ico
- AssemblyInfo.cs
- bin
- Debug
- config.xml
- Fail.ico
- Ignore.ico
- ka.ico
- Lib.dll
- Lib.pdb
- NotRun.ico
- Pass.ico
- UnitTest.dll
- UnitTest.pdb
- Untested.ico
- UTCore.dll
- UTCore.pdb
- UTExample.dll
- UTExample.pdb
- UTWinForm.exe
- UTWinForm.pdb
- obj
- Debug
- temp
- TempPE
- UTWinForm.exe
- UTWinForm.Form1.resources
- UTWinForm.pdb
- UTWinForm.projdata
- UTWinForm.cs
- UTWinForm.csproj
- UTWinForm.csproj.user
- UTWinForm.resx
|
using System;
using UnitTest;
namespace Calculator
{
[TestFixture]
public class CalculatorTest
{
private Calculator calc;
[TestSetUp]
public void Setup()
{
calc=new Calculator();
}
[TestTearDown]
public void TearDown()
{
calc=null;
}
[Test]
public void TestAddTwoPostiveInts()
{
double result;
result=calc.Add(1, 2);
Assertion.Assert(result==3, "Positive+Positive integer addition failure");
}
[Test]
public void TestAddNegativePostiveInts()
{
double result;
result=calc.Add(-10, 20);
Assertion.Assert(result==10, "Negative+Positive integer addition failure");
}
[Test]
public void TestAddTwoNegativeInts()
{
double result;
result=calc.Add(-10, -20);
Assertion.Assert(result==-30, "Negative+Negative integer addition failure");
}
[Test]
public void TestAddTwoPostivesReals()
{
double result;
result=calc.Add(1.25, 3.5);
Assertion.Assert(result==4.75, "real addition failure");
}
}
public class Calculator
{
private double value=5.0;
public int Add(int a, int b)
{
return a+b;
}
public double Add(double a, double b)
{
return (a+b)/value;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here