Skip to content

Commit

Permalink
Added remaining acceptance tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewrenze committed Dec 13, 2016
1 parent 74654b1 commit 6ab726c
Show file tree
Hide file tree
Showing 19 changed files with 592 additions and 75 deletions.
12 changes: 12 additions & 0 deletions Specification/Customers/GetCustomersList/GetCustomersList.feature
@@ -0,0 +1,12 @@
Feature: Get Customers List
As a sales person
I want to get a list of customers
So I can inspect the customers

Scenario: Get a List of Customers
When I request a list of customers
Then the following customers should be returned:
| Id | Name |
| 1 | Martin Fowler |
| 2 | Uncle Bob |
| 3 | Kent Beck |

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions Specification/Customers/GetCustomersList/GetCustomersListSteps.cs
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CleanArchitecture.Application.Customers.Queries.GetCustomerList;
using CleanArchitecture.Specification.Common;
using NUnit.Framework;
using TechTalk.SpecFlow;
using TechTalk.SpecFlow.Assist;

namespace CleanArchitecture.Specification.Customers.GetCustomersList
{
[Binding]
public class GetCustomersListSteps
{
private readonly AppContext _context;
private List<CustomerModel> _results;

public GetCustomersListSteps(AppContext context)
{
_context = context;
}

[When(@"I request a list of customers")]
public void WhenIRequestAListOfCustomers()
{
var query = _context.Container
.GetInstance<GetCustomersListQuery>();

_results = query.Execute();
}

[Then(@"the following customers should be returned:")]
public void ThenTheFollowingCustomersShouldBeReturned(Table table)
{
var models = table.CreateSet<CustomerModel>().ToList();

for (var i = 0; i < models.Count(); i++)
{
var model = models[i];

var result = _results[i];

Assert.That(result.Id,
Is.EqualTo(model.Id));

Assert.That(result.Name,
Is.EqualTo(model.Name));
}
}
}
}
12 changes: 12 additions & 0 deletions Specification/Employees/GetEmployeesList/GetEmployeesList.feature
@@ -0,0 +1,12 @@
Feature: Get Employees List
As a sales person
I want to get a list of employees
So I can inspect the employees

Scenario: Get a List of Employees
When I request a list of employees
Then the following employees should be returned:
| Id | Name |
| 1 | Eric Evans |
| 2 | Greg Young |
| 3 | Udi Dahan |

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions Specification/Employees/GetEmployeesList/GetEmployeesListSteps.cs
@@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Linq;
using CleanArchitecture.Application.Employees.Queries.GetEmployeesList;
using CleanArchitecture.Specification.Common;
using NUnit.Framework;
using TechTalk.SpecFlow;
using TechTalk.SpecFlow.Assist;

namespace CleanArchitecture.Specification.Employees.GetEmployeesList
{
[Binding]
public class GetEmployeesListSteps
{
private readonly AppContext _context;
private List<EmployeeModel> _results;

public GetEmployeesListSteps(AppContext context)
{
_context = context;
}

[When(@"I request a list of employees")]
public void WhenIRequestAListOfEmployees()
{
var query = _context.Container
.GetInstance<GetEmployeesListQuery>();

_results = query.Execute();
}

[Then(@"the following employees should be returned:")]
public void ThenTheFollowingEmployeesShouldBeReturned(Table table)
{
var models = table.CreateSet<EmployeeModel>().ToList();

for (var i = 0; i < models.Count(); i++)
{
var model = models[i];

var result = _results[i];

Assert.That(result.Id,
Is.EqualTo(model.Id));

Assert.That(result.Name,
Is.EqualTo(model.Name));
}
}
}
}
12 changes: 12 additions & 0 deletions Specification/Products/GetProductsList.feature
@@ -0,0 +1,12 @@
Feature: Get Products List
As a sales person
I want to get a list of products
So I can inspect the products

Scenario: Get a List of Products
When I request a list of products
Then the following products should be returned:
| Id | Name | Unit Price |
| 1 | Spaghetti | 5.00 |
| 2 | Lasagne | 10.00 |
| 3 | Ravioli | 15.00 |

0 comments on commit 6ab726c

Please sign in to comment.