Ejemplo n.º 1
0
		public void Completed_EmptySet_Zero()
		{
			var sut = new Master("CSharp");

			var a = sut.Analyze(new string[0], new Analysis());

			Assert.Equal(0, a.CompletedKoans);
		}
Ejemplo n.º 2
0
		public void FailedKoan_EmptySet_NoProgress()
		{
			var sut = new Master("CSharp");

			var a = sut.Analyze(new string[0], new Analysis());

			Assert.Equal(String.Empty, a.FailedKoan);
		}
Ejemplo n.º 3
0
		public void LastPassedKoan_OnePassed_LastPassedIdentified()
		{
			var sut = new Master("CSharp");

			var a = sut.Analyze(new string[] { "DotNetKoans.CSharp.AboutAsserts.AssertTruth has expanded your awareness" }, new Analysis());

			Assert.Equal("CSharp.AboutAsserts.AssertTruth", a.LastPassedKoan);
		}
Ejemplo n.º 4
0
		public void WhereToSeek_FailedKoan_ArrayOfLines()
		{
			var output = "\r\n\r\n*******************************************************************\r\n*******************************************************************\r\nDotNetKoans.CSharp.AboutAsserts.AssertTruth has expanded your awareness\r\nDotNetKoans.CSharp.AboutAsserts.AssertTruthWithMessage has expanded your awareness\r\nDotNetKoans.CSharp.AboutAsserts.AssertEquality has expanded your awareness\r\nThe test DotNetKoans.CSharp.AboutAsserts.ABetterWayOfAssertingEquality has damaged your karma. The following stack trace has been declared to be at fault\r\nAssert.Equal() Failure\r\nExpected: 3\r\nActual:   2\r\n   at DotNetKoans.CSharp.AboutAsserts.ABetterWayOfAssertingEquality() in C:\\Users\\jaargero\\DotNetKoans\\CSharp\\AboutAsserts.cs:line 36\r\n<test name=\"DotNetKoans.CSharp.AboutAsserts.ABetterWayOfAssertingEquality\" type=\"DotNetKoans.CSharp.AboutAsserts\" method=\"ABetterWayOfAssertingEquality\" result=\"Fail\" time=\"0.098\"><failure exception-type=\"Xunit.Sdk.EqualException\"><message>Assert.Equal() Failure\r\nExpected: 3\r\nActual:   2</message><stack-trace>   at DotNetKoans.CSharp.AboutAsserts.ABetterWayOfAssertingEquality() in C:\\Users\\jaargero\\DotNetKoans\\CSharp\\AboutAsserts.cs:line 36</stack-trace></failure></test>\r\nKoan progress:(3/5),(0/5),(0/6),(0/3),(0/6),(0/23),(0/9),(0/11),(0/16),(0/23),(0/7),\r\n*******************************************************************\r\n*******************************************************************\r\n\r\n\r\n";
			var sut = new Master("CSharp");

			string[] lines = output.Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);

			Assert.Equal(new string[] { "Assert.Equal() Failure", "Expected: 3", "Actual:   2" }, sut.WhereToSeek(lines));
		}
Ejemplo n.º 5
0
 private static void EchoResult(string output, string projectName)
 {
     string[] lines = output.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
     Master master = new Master(projectName);
     _Prior = master.Analyze(lines, _Prior);
     PrintLastActions(_Prior);
     PrintMastersComments(_Prior);
     PrintAnswersYouSeek(lines, _Prior);
     PrintFinalWords(_Prior);
 }
Ejemplo n.º 6
0
		public void Attempts_FirstTry_Zero()
		{
			var sut = new Master("CSharp");

			var a = sut.Analyze(new [] {
				"The test DotNetKoans.CSharp.AboutAsserts.AssertTruth has damaged your karma. The following stack trace has been declared to be at fault" 
			}, new Analysis());

			Assert.Equal(0, a.FailedAttempts);
		}
Ejemplo n.º 7
0
		public void Completed_OnePassedOneFailed_One()
		{
			var sut = new Master("CSharp");

			var a = sut.Analyze(new string[] {
				"DotNetKoans.CSharp.AboutAsserts.AssertTruth has expanded your awareness",
				"The test DotNetKoans.CSharp.AboutAsserts.AssertTruthWithMessage has damaged your karma. The following stack trace has been declared to be at fault" 
			}, new Analysis());

			Assert.Equal(1, a.CompletedKoans);
		}
Ejemplo n.º 8
0
		public void TotalKoans_ZeroFiveZeroFiveZeroFive_ThreeUnderscores()
		{
			var sut = new Master("CSharp");

			var a = sut.Analyze(new[] { "Koan progress:(0/5),(0/5),(0/5)," }, new Analysis());

			Assert.Equal(15, a.TotalKoans);
		}
Ejemplo n.º 9
0
		public void ProgressBar_FiveFiveOneFiveZeroFive_DotXUnderscore()
		{
			var sut = new Master("CSharp");

			var a = sut.Analyze(new[] { "Koan progress:(5/5),(1/5),(0/5)," }, new Analysis());

			Assert.Equal(".X_", a.ProgressBar);
		}
Ejemplo n.º 10
0
		public void ProgressBar_ZeroFiveZeroFiveZeroFive_ThreeUnderscores()
		{
			var sut = new Master("CSharp");

			var a = sut.Analyze(new[] { "Koan progress:(0/5),(0/5),(0/5)," }, new Analysis());

			Assert.Equal("___", a.ProgressBar);
		}