Skip to content

Commit

Permalink
Add tests chapter03 v8 (#75)
Browse files Browse the repository at this point in the history
* Rename Listing03.01, 03.02 to add period

* Add tests to Listings 02, 22, 26, 29
  • Loading branch information
COsborn2 authored Jul 23, 2019
1 parent 365966f commit 5519aa8
Show file tree
Hide file tree
Showing 6 changed files with 85 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Chapter03.Tests/Listing03.02.Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_02.Tests
{
[TestClass]
public class UppercaseTests
{
[TestMethod]
public void Main_GivenValidString_MakeUppercase()
{
const string expected =
@"Enter text: <<test
>>TEST";

IntelliTect.TestTools.Console.ConsoleAssert.Expect(
expected, Uppercase.Main);
}
}
}
18 changes: 18 additions & 0 deletions src/Chapter03.Tests/Listing03.22.Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_22.Tests
{
[TestClass]
public class ProgramTests
{
[TestMethod]
public void Main_GetCountOnArray_ReturnArrayLength()
{
const string expected =
"There are 9 languages in the array.";

IntelliTect.TestTools.Console.ConsoleAssert.Expect(
expected, Program.Main);
}
}
}
18 changes: 18 additions & 0 deletions src/Chapter03.Tests/Listing03.26.Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_26.Tests
{
[TestClass]
public class ProgramTests
{
[TestMethod]
public void Main_GetLengthOfDimensionOf3DArray_ReturnsLength()
{
const string expected =
"2";

IntelliTect.TestTools.Console.ConsoleAssert.Expect(
expected, Program.Main);
}
}
}
30 changes: 30 additions & 0 deletions src/Chapter03.Tests/Listing03.29.Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter03.Listing03_29.Tests
{
[TestClass]
public class PalindromeTests
{
[TestMethod]
public void Main_InputValidPalindrome_IdentifiedAsPalindrome()
{
const string expected =
@"Enter a palindrome: <<kayak
>>""kayak"" is a palindrome.";

IntelliTect.TestTools.Console.ConsoleAssert.Expect(
expected, Palindrome.Main);
}

[TestMethod]
public void Main_InputInvalidPalindrome_NotIdentifiedAsPalindrome()
{
const string expected =
@"Enter a palindrome: <<test
>>""test"" is NOT a palindrome.";

IntelliTect.TestTools.Console.ConsoleAssert.Expect(
expected, Palindrome.Main);
}
}
}

0 comments on commit 5519aa8

Please sign in to comment.