using System; using System.Collections.Generic; using System.Text; using NUnit.Framework; namespace ConsoleApplication3 { class Program { static void Main(string[] args) { } public float balance; public void Deposite(float amount) { balance += amount; } public void withdraw(float amount) { balance -= amount; } public void TransferFunds(Program destination, float amount) { } public float Balance { get { return balance; } } public static void testmethod() { Program a1 = new Program(); a1.Deposite(200.00f); Program a2 = new Program(); a2.Deposite(15.00f); a1.TransferFunds(a2, 100.00f); Program.Equals(250.00f, a2.balance); Program.Equals(100.00f, a1.balance); } } [TestFixture()] public class Calculator_UnitTest { Program a1 = new Program(); [SetUp()] public void Init() { // some code here, that need to be run // at the start of every test case. } [TearDown()] public void Clean() { // code that will be called after each Test case } [Test] public void Test() { Program a1 = new Program(); a1.Deposite(200.00f); Program a2 = new Program(); a2.Deposite(15.00f); a1.TransferFunds(a2, 100.00f); Program.Equals(250.00f, a2.balance); Program.Equals(100.00f, a1.balance); } } }
NUnit.Framework
[TestFixture()]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)