This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources: | |
# The 'repo' section defines the code repository (self means 'this one' i.e. SprintTracker) | |
- repo: self | |
# The 'queue' section defines the machine on which we'll run our code and what are the tools we'll need to run the tests | |
queue: | |
# We'll use a standard machine that Azure provides for free with Visual Studio 2017 | |
name: Hosted Windows 2019 with VS2019 | |
# This just checks that the following software is installed on our 'Hosted VS2017' machine, as we need it to run our tests. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public object GetAveragePoints(SprintTrackerWebContext context) | |
{ | |
// Create an empty list to store the points. | |
List<int> points = new List<int>(); | |
// Get the points from each sprint in the database and add them to the list. | |
context.Sprint.ToList().ForEach(x => points.Add(x.ActualPoints)); | |
// Check to see if the `points` list has any data in it | |
if (points.Any()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void EmptyList() | |
{ | |
// ARRANGE | |
// Initialise the Statistics class | |
Statistics stats = new Statistics(); | |
// Set up 'in memory' database (can’t mock a context) | |
var options = new | |
DbContextOptionsBuilder<SprintTrackerWebContext>() | |
.UseInMemoryDatabase(databaseName: "Add_writes_to_database").Options; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.EntityFrameworkCore; | |
using SprintTracker.Web; | |
using SprintTracker.Web.Models; | |
using System.Linq; | |
using Xunit; | |
namespace SprintTracker.Tests | |
{ | |
public class SprintTrackerWebContextTest | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.AspNetCore.Mvc; | |
using Microsoft.EntityFrameworkCore; | |
using SprintTracker.Web.Controllers; | |
using SprintTracker.Web.Models; | |
using System.Threading.Tasks; | |
using Xunit; | |
namespace SprintTracker.Tests | |
{ | |
public class SprintsControllerTest | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
specflow.exe nunitexecutionreport --ProjectFile ToolsList.AcceptanceTests\ToolsList.AcceptanceTests.csproj --xmlTestResult TestResult.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nunit3-console.exe --labels=All --out=TestResult.txt “--result=TestResult.xml;format=nunit2” ToolsList.AcceptanceTests\bin\Debug\ToolsList.AcceptanceTests.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources: | |
# The 'repo' section defines the code repository (self means 'this one' i.e. ToolsList) | |
- repo: self | |
# The 'queue' section defines the machine on which we'll run our code and what are the tools we'll need to run the tests | |
queue: | |
# We'll use a standard machine that Azure provides for free. It comes pre-installed with Visual Studio 2017 | |
name: Hosted Windows 2019 with VS2019 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static string GetPathToMyDocuments() | |
{ | |
// return the absolute path to the MyDocuments folder on your computer | |
return Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); | |
} | |
// you need to pass through the filename you want to call your screenshot | |
public static void FullScreenScreenshot(string fileName) | |
{ | |
// take the screenshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static IWebElement WaitForElement(By locator) | |
{ | |
// Here we set the timeout as 5 second, 0 minutes and 0 hours | |
WebDriverWait wait = new WebDriverWait(Browser, new TimeSpan(0, 0, 5)); | |
// Here we set the `Until` condition as until the browser finds the element. If it find the element in 5 seconds, it will return it. | |
return wait.Until(Browser => Browser.FindElement(locator)); | |
} |
NewerOlder