-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from tdwright/develop
Version 0.2.0. Refactoring with some breaking changes to public API. Notably, OutputBuilder is now nested and private and Corners have been split out into a separate class.
- Loading branch information
Showing
7 changed files
with
228 additions
and
124 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using ConTabs.TestData; | ||
using NUnit.Framework; | ||
using Shouldly; | ||
using System; | ||
|
||
namespace ConTabs.Tests | ||
{ | ||
[TestFixture] | ||
class UsageTests | ||
{ | ||
[Test] | ||
public void OnceFormatSet_FormatCanBeUpdated() | ||
{ | ||
// Arrange | ||
var tableObj = Table<TestDataType>.Create(); | ||
tableObj.TableStyle = Style.Default; | ||
|
||
// Act | ||
tableObj.TableStyle = Style.Heavy; | ||
var result = tableObj.ToString(); | ||
|
||
// Assert | ||
result[0].ShouldBe('#'); | ||
} | ||
|
||
[Test] | ||
public void OnceFormatSet_CornerCanBeUpdated() | ||
{ | ||
// Arrange | ||
var tableObj = Table<TestDataType>.Create(); | ||
tableObj.TableStyle = Style.Default; | ||
|
||
// Act | ||
tableObj.TableStyle.Corners.CornerTopLeft = '$'; | ||
var result = tableObj.ToString(); | ||
|
||
// Assert | ||
result[0].ShouldBe('$'); | ||
} | ||
|
||
} | ||
} |
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,50 @@ | ||
namespace ConTabs | ||
{ | ||
public class Corners | ||
{ | ||
private readonly char[,] cornerChars = new char[3, 3]; | ||
|
||
/* | ||
* ╔═══╤═════╤═════╤═════╗ | ||
* ║ │ 0 │ 1 │ 2 ║ | ||
* ╠═══╪═════╪═════╪═════╣ | ||
* ║ 0 │ TL │ TNU │ TR ║ | ||
* ╟───┼─────┼─────┼─────╢ | ||
* ║ 1 │ TNL │ I │ TNR ║ | ||
* ╟───┼─────┼─────┼─────╢ | ||
* ║ 2 │ BL │ TND │ BR ║ | ||
* ╚═══╧═════╧═════╧═════╝ | ||
* | ||
*/ | ||
|
||
public char CornerTopLeft { get { return cornerChars[0, 0]; } set { cornerChars[0, 0] = value; } } | ||
public char CornerTopRight { get { return cornerChars[2, 0]; } set { cornerChars[2, 0] = value; } } | ||
public char CornerBottomLeft { get { return cornerChars[0, 2]; } set { cornerChars[0, 2] = value; } } | ||
public char CornerBottomRight { get { return cornerChars[2, 2]; } set { cornerChars[2, 2] = value; } } | ||
|
||
public char Intersection { get { return cornerChars[1, 1]; } set { cornerChars[1, 1] = value; } } | ||
public char TeeNoUp { get { return cornerChars[1, 0]; } set { cornerChars[1, 0] = value; } } | ||
public char TeeNoRight { get { return cornerChars[2, 1]; } set { cornerChars[2, 1] = value; } } | ||
public char TeeNoDown { get { return cornerChars[1, 2]; } set { cornerChars[1, 2] = value; } } | ||
public char TeeNoLeft { get { return cornerChars[0, 1]; } set { cornerChars[0, 1] = value; } } | ||
|
||
public char this[int i, int j] | ||
{ | ||
get | ||
{ | ||
return cornerChars[i, j]; | ||
} | ||
} | ||
|
||
public void SetAllCorners(char corner) | ||
{ | ||
for(int i=0;i<cornerChars.GetLength(0);i++) | ||
{ | ||
for(int j =0;j<cornerChars.GetLength(1);j++) | ||
{ | ||
cornerChars[i, j] = corner; | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.