Advertisement
Dennisaa

SpecFlow MathIdiot 01

Sep 28th, 2015
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.80 KB | None | 0 0
  1. using System;
  2. using TechTalk.SpecFlow;
  3. using Microsoft.VisualStudio.TestTools.UnitTesting;
  4.  
  5. namespace MyNamespace {
  6.     [Binding]
  7.     public class StepDefinitions {
  8.         public int NumberToAdd { get; private set; }
  9.  
  10.         private StepDefinitions() {
  11.             NumberToAdd = 0;
  12.         }
  13.  
  14.         [Given(@"I have entered (.*) into the calculator")]
  15.         public void GivenIHaveEnteredIntoTheCalculator(int numberToAdd) {
  16.             NumberToAdd += numberToAdd;
  17.         }
  18.  
  19.         [When(@"I press add")]
  20.         public void WhenIPressAdd() {
  21.            //nothing to do
  22.         }
  23.  
  24.         [Then(@"the result should be (.*) on the screen")]
  25.         public void ThenTheResultShouldBeOnTheScreen(int expectedSum) {
  26.             Assert.AreEqual(expectedSum, NumberToAdd);
  27.         }
  28.     }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement