-
Notifications
You must be signed in to change notification settings - Fork 6
/
AddSomeNumbersSteps.cs
82 lines (67 loc) · 2.31 KB
/
AddSomeNumbersSteps.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
namespace SampleBddTest
{
using Netty;
using NUnit.Framework;
using SampleBddTest.AddService;
using TechTalk.SpecFlow;
[Binding]
public class AddSomeNumbersSteps
{
private static NettyServer _webServer;
[BeforeFeature]
public static void Startup()
{
_webServer = new NettyServer(@"..\..\..\SampleWebSite", "/", 9015);
_webServer.Start();
}
[AfterFeature]
public static void Shutdown()
{
_webServer.Stop();
}
[Given(@"I have entered the first number (.*) into the calculator")]
public void GivenIHaveEnteredTheFirstNumberIntoTheCalculator(int p0)
{
ScenarioContext.Current.Add("first", p0);
}
[Given(@"I have entered the second number (.*) into the calculator")]
public void GivenIHaveEnteredTheSecondNumberIntoTheCalculator(int p0)
{
ScenarioContext.Current.Add("second", p0);
}
[Given(@"The AddTwoNumbers web service")]
public void GivenTheAddTwoNumbersWebService()
{
}
[When(@"I call the web service to add the numbers")]
public void WhenICallTheWebServiceToAddTheNumbers()
{
using (var service = new AddTwoNumbers())
{
var result = service.AddNumbers(
ScenarioContext.Current.Get<int>("first"), ScenarioContext.Current.Get<int>("second"));
ScenarioContext.Current.Add("result", result);
}
}
[When(@"I call the HelloWorld method")]
public void WhenICallTheHelloWorldMethod()
{
using (var service = new AddTwoNumbers())
{
var result = service.HelloWorld();
ScenarioContext.Current.Add("result", result);
}
}
[Then(@"the result should be (.*)")]
public void ThenTheResultShouldBe(int p0)
{
Assert.AreEqual(p0, ScenarioContext.Current.Get<int>("result"));
}
[Then(@"I should receive the message ""(.*)""")]
public void ThenIShouldReceiveTheMessage(string p0)
{
Assert.AreEqual(
p0, ScenarioContext.Current.Get<string>("result"));
}
}
}