Skip to content

Instantly share code, notes, and snippets.

@danalexilewis
Created March 30, 2015 01:47
Show Gist options
  • Save danalexilewis/2b2abf5f46e38959eda5 to your computer and use it in GitHub Desktop.
Save danalexilewis/2b2abf5f46e38959eda5 to your computer and use it in GitHub Desktop.
hihi - nunit test demo
using System;
using NUnit.Framework;
namespace UnitTestProject
{
[TestFixture]
public class UnitTest1
{
CleverCalcutor calcutor;
[SetUp]
public void init()
{
calcutor = new CleverCalcutor();
}
[Test]
public void TestTester()
{
Assert.IsTrue(true);
}
[Test]
public void Mulitplication_Returns_Expected()
{
// Arrange
int expected = calcutor.expected;
calcutor.expected = 3;
calcutor.Times();
}
[Test]
public void Add_Returns_Expected()
{
// Arrange
int expected = calcutor.expected;
int actual;
// Act
actual = calcutor.Addition(8, 4);
// Assert
Assert.AreEqual(expected,actual);
}
}
}
namespace UnitTestProject
{
public class CleverCalcutor
{
public int expected = 12;
public void Times()
{
throw new NotImplementedException();
}
public int Addition(int p1, int p2)
{
return p2 + p1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment