-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial implementations #26
Conversation
Console.WriteLine(); | ||
hasHeaderWritten = true; | ||
} | ||
CheckIfSameHeaders(res); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a very good addition for safety, but not a very good addition for speed. Since this is really a tool to support unit tests, I think this is great.
for (int i = 0; i < res.GetResultItems().Length; i++) | ||
{ | ||
Console.Write(res.GetResultItems()[i].ResultName); | ||
if (i < res.GetResultItems().Length - 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an alternative pattern is to write the first row, loop for i=1 to < length. for each i'th option write , value. that can eliminate the if check on each element.
Consequences/Results/Result.cs
Outdated
@@ -8,6 +8,11 @@ public Result(ResultItem[] resultItems) | |||
_resultItems = resultItems; | |||
} | |||
|
|||
public ResultItem[] GetResultItems() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a nice thing about unit tests is that you implement an activity that seeks to reach a goal (like writing results) and you find that your interfaces or implementations are missing things. That helps you ensure your code does what it needs to do. Great find and fix.
[Fact] | ||
public void TestHeaders() | ||
{ | ||
var stringWriter = new StringWriter(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great addition in a unit test to verify behavior with an assert.
Another way you could do this is to write a "stringbuilderresultswriter" where the result is internally stored in a string builder. I like your approach because it can be utilized in many ways.
ConsequencesTest/StructureTest.cs
Outdated
public class StructureTest | ||
{ | ||
[Fact] | ||
public void TestSimpleDepth() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a great first test. write a test to write to the results writer too
…k on console output from StructureTest (test had weird behavior, console output passes intermittently but values are correct) #18
Testing console output is painful and poorly supported. I suggested to Jack, for the ConsoleWriter, to move the business logic of creating the string into a separate method, and honor the Write(Result res) interface with a very simple implementatin that calls the business logic, then writes the output string to console. I think that cleans up the testing and still accomplishes the goal. |
…console output
Looks like using the Issue number only soft links the commit to the issue, but doesn't close it out once merged. Moving forward, lets use Fix #xx as the syntax for commits that address specific issues. When we miss them, which is no big deal, add them manually from the PR page under "Development" I've added some of them already. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great
@@ -7,15 +7,18 @@ | |||
namespace USACE.HEC.Geography; | |||
public class BoundingBox | |||
{ | |||
private Location _upperLeft; | |||
private Location _lowerRight; | |||
public Location _upperLeft; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks "sus"
@@ -1,8 +1,8 @@ | |||
namespace USACE.HEC.Geography; | |||
public class BoundingBox | |||
{ | |||
public Location _upperLeft; | |||
public Location _lowerRight; | |||
private Location _upperLeft; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yay!
…ate types to double to match NSI #27
No description provided.