-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
117 additions
and
117 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
...otBrigade.Weevil.Core/RegionOfInterest.cs → Src/BlueDotBrigade.Weevil.Core/Bookend.cs
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
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
110 changes: 110 additions & 0 deletions
110
Tst/BlueDotBrigade.Weevil.Core-UnitTests/BookendManagerTests.cs
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using BlueDotBrigade.Weevil.Core; | ||
|
||
namespace BlueDotBrigade.Weevil.Core.UnitTests | ||
{ | ||
[TestClass] | ||
public class RegionManagerTests | ||
{ | ||
private BookendManager _bookendManager; | ||
|
||
[TestInitialize] | ||
public void Setup() | ||
{ | ||
_bookendManager = new BookendManager(); | ||
} | ||
|
||
[TestMethod] | ||
public void MarkEnd_AfterStart_BookendCreated() | ||
{ | ||
// Arrange | ||
int startIndex = 800; | ||
int endIndex = 900; | ||
_bookendManager.MarkStart(startIndex); | ||
|
||
// Act | ||
_bookendManager.MarkEnd(endIndex); | ||
|
||
// Assert | ||
Assert.AreEqual(1, _bookendManager.Bookends.Length); | ||
Assert.AreEqual(startIndex, _bookendManager.Bookends[0].StartLineNumber); | ||
Assert.AreEqual(endIndex, _bookendManager.Bookends[0].EndLineNumber); | ||
} | ||
|
||
[TestMethod] | ||
[ExpectedException(typeof(InvalidOperationException))] | ||
public void MarkEnd_WithoutStart_ThrowsInvalidOperationException() | ||
{ | ||
// Arrange | ||
int endIndex = 900; | ||
|
||
// Act | ||
_bookendManager.MarkEnd(endIndex); | ||
|
||
// Assert handled by ExpectedException | ||
} | ||
|
||
[TestMethod] | ||
public void Bookends_CreateMultipleBookends_ReturnsAllBookends() | ||
{ | ||
// Arrange | ||
_bookendManager.MarkStart(800); | ||
_bookendManager.MarkEnd(900); | ||
|
||
_bookendManager.MarkStart(950); | ||
_bookendManager.MarkEnd(1000); | ||
|
||
// Act | ||
// Assert | ||
Assert.AreEqual(2, _bookendManager.Bookends.Length); | ||
Assert.AreEqual(800, _bookendManager.Bookends[0].StartLineNumber); | ||
Assert.AreEqual(900, _bookendManager.Bookends[0].EndLineNumber); | ||
Assert.AreEqual(950, _bookendManager.Bookends[1].StartLineNumber); | ||
Assert.AreEqual(1000, _bookendManager.Bookends[1].EndLineNumber); | ||
} | ||
|
||
[TestMethod] | ||
public void Clear_ExistingBookends_AllBookendsDeleted() | ||
{ | ||
// Arrange | ||
_bookendManager.MarkStart(800); | ||
_bookendManager.MarkEnd(900); | ||
|
||
// Act | ||
_bookendManager.Clear(); | ||
|
||
// Assert | ||
Assert.AreEqual(0, _bookendManager.Bookends.Length); | ||
} | ||
|
||
[TestMethod] | ||
public void Clear_IndexIsWithinBookend_BookendDeleted() | ||
{ | ||
// Arrange | ||
_bookendManager.MarkStart(800); | ||
_bookendManager.MarkEnd(900); | ||
|
||
// Act | ||
_bookendManager.Clear(850); | ||
|
||
// Assert | ||
Assert.AreEqual(0, _bookendManager.Bookends.Length); | ||
} | ||
|
||
[TestMethod] | ||
[ExpectedException(typeof(InvalidOperationException))] | ||
public void Clear_LineNumberIsOutsideOfBookend_Throws() | ||
{ | ||
// Arrange | ||
_bookendManager.MarkStart(800); | ||
_bookendManager.MarkEnd(900); | ||
|
||
// Act | ||
_bookendManager.Clear(100); | ||
|
||
// Assert | ||
Assert.AreEqual(1, _bookendManager.Bookends.Length); | ||
} | ||
} | ||
} |
110 changes: 0 additions & 110 deletions
110
Tst/BlueDotBrigade.Weevil.Core-UnitTests/RegionManagerTests.cs
This file was deleted.
Oops, something went wrong.