Skip to content

Commit

Permalink
WIP debugging suite-only failures.
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabrock committed Feb 11, 2015
1 parent ea0ab07 commit e5c5b69
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 34 deletions.
14 changes: 13 additions & 1 deletion TestWaitForIt/AddingCountdownsTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TestStack.BDDfy;
using WaitForIt.Model;

namespace TestWaitForIt
{
Expand All @@ -18,6 +18,18 @@ public class AddingCountdownsTest : TestHelper
// * The event shows up in the main event list and the form goes away
// * Click "x" to close the form

[ClassInitialize]
public static void SetupTests(TestContext _context)
{
TestHelper.Setup(_context);
}

[ClassCleanup]
public static void CleanUp()
{
TestHelper.CleanThisUp();
}

[TestMethod]
public void ScenarioHappyPathEventCreation()
{
Expand Down
4 changes: 2 additions & 2 deletions TestWaitForIt/EventModelTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ public void CreatingAnEventStoresItInEvents()
[TestMethod]
public void CreatingAnEventStoresItsProperties()
{
Event valentines = new Event("Valentine's", "02/14/14");
Assert.AreEqual("Valentine's", valentines.Name);
Event valentines = new Event("Someday", "02/14/14");
Assert.AreEqual("Someday", valentines.Name);
Assert.AreEqual("02/14/14", valentines.Date);
}
}
Expand Down
14 changes: 6 additions & 8 deletions TestWaitForIt/EventRepositoryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public static void SetUp(TestContext _context)
public static void CleanUp()
{
repo.Clear();
repo.Dispose();
}

[TestCleanup]
Expand All @@ -40,14 +39,14 @@ public void ClearDatabase()
public void TestAddToDatabase() //Valid
{
Assert.AreEqual(0, repo.GetCount());
repo.Add(new Event("New Years Eve", "12/31/2015"));
repo.Add(new Event("Old Years Eve", "12/31/2015"));
Assert.AreEqual(1, repo.GetCount());
}

[TestMethod]
public void TestAllMethod()
{
repo.Add(new Event("New Years Eve", "12/31/2015"));
repo.Add(new Event("Old Years Eve", "12/31/2015"));
repo.Add(new Event("Valentine's Day", "02/14/2015"));
Assert.AreEqual(2, repo.GetCount());
}
Expand All @@ -56,14 +55,14 @@ public void TestAllMethod()
public void TestGetCount()
{
Assert.AreEqual(0, repo.GetCount());
repo.Add(new Event("New Years Eve", "12/31/2015"));
repo.Add(new Event("Old Years Eve", "12/31/2015"));
Assert.AreEqual(1, repo.GetCount());
}

[TestMethod]
public void TestClear()
{
repo.Add(new Event("New Years Eve", "12/31/2015"));
repo.Add(new Event("Old Years Eve", "12/31/2015"));
repo.Clear();
Assert.AreEqual(0, repo.GetCount());
}
Expand All @@ -74,10 +73,9 @@ public void TestClear()
[ExpectedException(typeof(ArgumentException))]
public void EventsAreUnique()
{
Event e = new Event("New Years Eve", "12/31/2015");
repo.Clear();
repo.Add(e);
repo.Add(e);
repo.Add(new Event("Old Years Eve", "12/31/2015"));
repo.Add(new Event("Old Years Eve", "12/31/2015"));
}
}
}
4 changes: 2 additions & 2 deletions TestWaitForIt/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace TestWaitForIt
public class TestHelper
{
private static TestContext test_context;
private static Window window;
protected static Window window;
private static Application application;
private static EventRepository repo = new EventRepository();
private static EventContext context;
Expand Down Expand Up @@ -149,8 +149,8 @@ public static void GivenTheseEvents(params Event[] events)
public static void CleanThisUp()
{
window.Close();
repo.Clear();
application.Close();
repo.Clear();
}
}
}
4 changes: 2 additions & 2 deletions TestWaitForIt/ViewingCountdownsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class ViewingCountdownsTest : TestHelper
public static void SetupTests(TestContext _context)
{
GivenTheseEvents(
new Event("Valentine's Day", "02/14/15"),
new Event("Valentine's Eve", "02/13/15"),
new Event("Christmas", "12/25/14")
);
TestHelper.Setup(_context);
Expand All @@ -31,7 +31,7 @@ public static void CleanUp()
public void ScenarioViewingCountdownsWhenThereAreEvents()
{
ThenIShouldSeeXEvents(2);
AndIShouldSeeACountdownFor("Valentine's Day", "02/14/15");
AndIShouldSeeACountdownFor("Valentine's Eve", "02/13/15");
AndIShouldSeeACountdownFor("Christmas", "12/25/14");
AndIShouldNotSeeTheHelperText();
AndTheButtonShouldBeEnabled("+");
Expand Down
28 changes: 9 additions & 19 deletions TestWaitForIt/ZeroStateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,18 @@
namespace TestWaitForIt
{
[TestClass]
public class ZeroStateTest
public class ZeroStateTest : TestHelper
{

private static TestContext test_context;
private static Window window;
private static Application application;

[ClassInitialize]
public static void Setup(TestContext _context)
public static void SetupTests(TestContext _context)
{
TestHelper.Setup(_context);
}

[ClassCleanup]
public static void CleanUp()
{
test_context = _context;
var applicationDir = _context.DeploymentDirectory;
var applicationPath = Path.Combine(applicationDir, "..\\..\\..\\TestWaitForIt\\bin\\Debug\\WaitForIt");
application = Application.Launch(applicationPath);
window = application.GetWindow("MainWindow", InitializeOption.NoCache);
TestHelper.CleanThisUp();
}

[TestMethod]
Expand All @@ -41,12 +38,5 @@ public void TestZeroStateHelpElements()
var text = window.Get(SearchCriteria.ByAutomationId("GettingStartedText"));
Assert.IsTrue(text.Visible);
}

[ClassCleanup]
public static void CleanThisUp()
{
window.Close();
application.Close();
}
}
}

0 comments on commit e5c5b69

Please sign in to comment.