public void ThenANewAccountIsCreatedWithAUsernameOfAUsernameOf(string username) { using (var context = new SpecflowTestContext()) { var allUserProfiles = context.UserProfiles.ToList(); Assert.That(allUserProfiles.Count, Is.EqualTo(1)); Assert.That(allUserProfiles.First().UserName, Is.EqualTo(username)); } }
public static void BeforeFeature() // must be static { // Create the webdriver and store it in the feature context IWebDriver driver = new FirefoxDriver(); FeatureContext.Current.Set(driver); driver.Navigate().GoToUrl(Url); // Empty the database ready for the tests using (var context = new SpecflowTestContext()) { context.Database.ExecuteSqlCommand("DELETE FROM UserProfile"); } }