Skip to content

Commit

Permalink
Add tests chapter02 v8 (#70)
Browse files Browse the repository at this point in the history
* Remove Listing 02.01-02.06

* Add tests for Listing02.11, 22, 28, 29
  • Loading branch information
COsborn2 authored Jul 23, 2019
1 parent 7c719c8 commit 62cba23
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 35 deletions.
18 changes: 18 additions & 0 deletions src/Chapter02.Tests/Listing02.11.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.Chapter02.Listing02_11.Tests
{
[TestClass]
public class SingleQuoteTests
{
[TestMethod]
public void Main_WriteSingleQuote()
{
const string expected =
@"'";

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

namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter02.Listing02_22.Tests
{
[TestClass]
public class ProgramTests
{
[TestMethod]
[ExpectedException(typeof(System.OverflowException))]
public void Main_IntegerOverFlow_ExceptionThrown()
{
IntelliTect.TestTools.Console.ConsoleAssert.Execute("", Program.Main);
}
}
}
17 changes: 17 additions & 0 deletions src/Chapter02.Tests/Listing02.28.Tests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter02.Listing02_28.Tests
{
[TestClass]
public class ProgramTests
{
[TestMethod]
public void Main_PrintBoolConvertedToString()
{
const string expected = "True";

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

namespace AddisonWesley.Michaelis.EssentialCSharp.Chapter02.Listing02_29.Tests
{
[TestClass]
public class ProgramTests
{
[TestMethod]
public void Main_TryParseStringValidNumber_CorrectlyParsed()
{
const string expected =
@"Enter a number: <<42>>";

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

[TestMethod]
public void Main_TryParseStringNonNumber_IncorrectInput()
{
const string expected =
@"Enter a number: <<forty-two
>>The text entered was not a valid number.";

IntelliTect.TestTools.Console.ConsoleAssert.Expect(
expected, Program.Main);
}
}
}
35 changes: 0 additions & 35 deletions src/Chapter02/Listing02.01-2.06.SpecifyingLiteralValues.cs

This file was deleted.

0 comments on commit 62cba23

Please sign in to comment.