Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: lucaminudel/TDDwithMockObjectsAndDesignPrinciples
base: master
...
head fork: emilybache/TDDwithMockObjectsAndDesignPrinciples
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 13 commits
  • 146 files changed
  • 0 commit comments
  • 2 contributors
Showing with 2 additions and 9,314 deletions.
  1. BIN  Paper/mockobjects_emergingproperties.pdf
  2. BIN  Paper/mockobjects_emergingproperties_finaldraft.pdf
  3. +0 −17 Questionnaire/README.md
  4. +2 −9 README.md
  5. BIN  Slides/TDD-SOLID.pdf
  6. +0 −83 TDDMicroExercises.ProposedSolution/CSharp/TDDMicroExercises.OneSolution.csproj
  7. +0 −20 TDDMicroExercises.ProposedSolution/CSharp/TDDMicroExercises.OneSolution.sln
  8. +0 −54 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem.Tests/MockTelemetryDataChannel.cs
  9. +0 −28 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem.Tests/StubTelemetryConnection.cs
  10. +0 −29 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem.Tests/TelemetryDiagnosticControlsTest.cs
  11. +0 −10 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem/IConnection.cs
  12. +0 −8 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem/IDataChannel.cs
  13. +0 −33 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem/TelemetryClientConnection.cs
  14. +0 −67 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem/TelemetryDataChannel.cs
  15. +0 −57 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem/TelemetryDiagnosticControls.cs
  16. +0 −46 TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem.Tests/AlarmTest.cs
  17. +0 −28 TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem.Tests/StubSensor.cs
  18. +0 −40 TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem/Alarm.cs
  19. +0 −7 TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem/ISensor.cs
  20. +0 −24 TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem/Sensor.cs
  21. +0 −32 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser.Tests/MockTurnNumberSequence.cs
  22. +0 −44 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser.Tests/TicketDispenserTest.cs
  23. +0 −7 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser/ITurnNumberSequence.cs
  24. +0 −25 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser/TicketDispenser.cs
  25. +0 −14 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser/TurnNumberSequence.cs
  26. +0 −18 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser/TurnTicket.cs
  27. +0 −19 TDDMicroExercises.ProposedSolution/CSharp/UnicodeFileToHtmTextConverter.Tests/StubUnicodeTextSource.cs
  28. +0 −45 ...oExercises.ProposedSolution/CSharp/UnicodeFileToHtmTextConverter.Tests/UnicodeFileToHtmTextConverterTest.cs
  29. +0 −9 TDDMicroExercises.ProposedSolution/CSharp/UnicodeFileToHtmTextConverter/IUnicodeTextSource.cs
  30. +0 −38 TDDMicroExercises.ProposedSolution/CSharp/UnicodeFileToHtmTextConverter/UnicodeFileToHtmTextConverter.cs
  31. +0 −20 TDDMicroExercises.ProposedSolution/CSharp/UnicodeFileToHtmTextConverter/UnicodeTextSourceFromFile.cs
  32. BIN  TDDMicroExercises.ProposedSolution/CSharp/lib/nunit.framework.dll
  33. +0 −6 TDDMicroExercises.ProposedSolution/Java/.gitignore
  34. +0 −15 TDDMicroExercises.ProposedSolution/Java/TelemetrySystem/pom.xml
  35. +0 −10 ...ises.ProposedSolution/Java/TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/IConnection.java
  36. +0 −10 ...ses.ProposedSolution/Java/TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/IDataChannel.java
  37. +0 −34 ...posedSolution/Java/TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/TelemetryConnection.java
  38. +0 −67 ...osedSolution/Java/TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/TelemetryDataChannel.java
  39. +0 −48 ...ution/Java/TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/TelemetryDiagnosticControls.java
  40. +0 −38 ...dSolution/Java/TelemetrySystem/src/test/java/tddmicroexercises/telemetrysystem/TelemetryConnectionMock.java
  41. +0 −24 ...Solution/Java/TelemetrySystem/src/test/java/tddmicroexercises/telemetrysystem/TelemetryDataChannelMock.java
  42. +0 −18 ...emetrySystem/src/test/java/tddmicroexercises/telemetrysystem/TelemetryDiagnosticControlsCoveringsTests.java
  43. +0 −33 ...n/Java/TelemetrySystem/src/test/java/tddmicroexercises/telemetrysystem/TelemetryDiagnosticControlsTest.java
  44. +0 −20 TDDMicroExercises.ProposedSolution/Java/TextConverter/pom.xml
  45. +0 −20 ...roposedSolution/Java/TextConverter/src/main/java/tddmicroexercises/textconvertor/FileUnicodeDataSource.java
  46. +0 −9 ...es.ProposedSolution/Java/TextConverter/src/main/java/tddmicroexercises/textconvertor/UnicodeDataSource.java
  47. +0 −32 ...lution/Java/TextConverter/src/main/java/tddmicroexercises/textconvertor/UnicodeFileToHtmlTextConverter.java
  48. +0 −4 TDDMicroExercises.ProposedSolution/Java/TextConverter/src/test/java/data.txt
  49. +0 −23 ...roposedSolution/Java/TextConverter/src/test/java/tddmicroexercises/textconvertor/UnicodeDataSourceStub.java
  50. +0 −18 ...xtConverter/src/test/java/tddmicroexercises/textconvertor/UnicodeFileToHtmlTextConverterCoveringsTests.java
  51. +0 −35 ...n/Java/TextConverter/src/test/java/tddmicroexercises/textconvertor/UnicodeFileToHtmlTextConverterTests.java
  52. +0 −15 TDDMicroExercises.ProposedSolution/Java/TirePressureMonitoringSystem/pom.xml
  53. +0 −34 ...n/Java/TirePressureMonitoringSystem/src/main/java/tddmicroexercises/tirepressuremonitoringsystem/Alarm.java
  54. +0 −7 ...Java/TirePressureMonitoringSystem/src/main/java/tddmicroexercises/tirepressuremonitoringsystem/ISensor.java
  55. +0 −24 .../Java/TirePressureMonitoringSystem/src/main/java/tddmicroexercises/tirepressuremonitoringsystem/Sensor.java
  56. +0 −54 ...a/TirePressureMonitoringSystem/src/test/java/tddmicroexercises/tirepressuremonitoringsystem/AlarmTests.java
  57. +0 −18 ...a/TirePressureMonitoringSystem/src/test/java/tddmicroexercises/tirepressuremonitoringsystem/StubSensor.java
  58. +0 −15 TDDMicroExercises.ProposedSolution/Java/TurnTicketDispenser/pom.xml
  59. +0 −7 ...ution/Java/TurnTicketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/ITurnNumberSequence.java
  60. +0 −22 ...dSolution/Java/TurnTicketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/TicketDispenser.java
  61. +0 −13 ...lution/Java/TurnTicketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/TurnNumberSequence.java
  62. +0 −17 ...oposedSolution/Java/TurnTicketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/TurnTicket.java
  63. +0 −11 ...on/Java/TurnTicketDispenser/src/test/java/tddmicroexercises/turnticketdispenser/MockTurnNumberSequence.java
  64. +0 −18 ...nTicketDispenser/src/test/java/tddmicroexercises/turnticketdispenser/TurnTicketDispenserCoveringsTests.java
  65. +0 −25 .../Java/TurnTicketDispenser/src/test/java/tddmicroexercises/turnticketdispenser/TurnTicketDispenserTests.java
  66. +0 −188 TDDMicroExercises.ProposedSolution/Javascript/lib/jasmine-html.js
  67. +0 −166 TDDMicroExercises.ProposedSolution/Javascript/lib/jasmine.css
  68. +0 −2,421 TDDMicroExercises.ProposedSolution/Javascript/lib/jasmine.js
  69. +0 −74 TDDMicroExercises.ProposedSolution/Javascript/lib/jsfake.js
  70. +0 −35 TDDMicroExercises.ProposedSolution/Javascript/spec.runner.html
  71. +0 −22 TDDMicroExercises.ProposedSolution/Javascript/telemetry-system-tests/telemetry-diagnostic-controls-test.js
  72. +0 −36 TDDMicroExercises.ProposedSolution/Javascript/telemetry-system/telemetry-client-connection.js
  73. +0 −70 TDDMicroExercises.ProposedSolution/Javascript/telemetry-system/telemetry-data-channel.js
  74. +0 −43 TDDMicroExercises.ProposedSolution/Javascript/telemetry-system/telemetry-diagnostic-controls.js
  75. +0 −42 TDDMicroExercises.ProposedSolution/Javascript/tire-pressure-monitoring-system-tests/alarm-test.js
  76. +0 −32 TDDMicroExercises.ProposedSolution/Javascript/tire-pressure-monitoring-system/alarm.js
  77. +0 −20 TDDMicroExercises.ProposedSolution/Javascript/tire-pressure-monitoring-system/sensor.js
  78. +0 −42 TDDMicroExercises.ProposedSolution/Javascript/turn-ticket-dispenser-tests/ticket-dispenser-test.js
  79. +0 −20 TDDMicroExercises.ProposedSolution/Javascript/turn-ticket-dispenser/ticket-dispenser.js
  80. +0 −13 TDDMicroExercises.ProposedSolution/Javascript/turn-ticket-dispenser/turn-number-sequence.js
  81. +0 −12 TDDMicroExercises.ProposedSolution/Javascript/turn-ticket-dispenser/turn-ticket.js
  82. +0 −43 ...osedSolution/Javascript/unicode-file-to-htm-text-converter-tests/unicode-file-to-htm-text-converter-test.js
  83. +0 −19 TDDMicroExercises.ProposedSolution/Javascript/unicode-file-to-htm-text-converter/text-stream.js
  84. +0 −69 ...rcises.ProposedSolution/Javascript/unicode-file-to-htm-text-converter/unicode-file-to-htm-text-converter.js
  85. +0 −12 TDDMicroExercises.ProposedSolution/README.md
  86. +0 −10 TDDMicroExercises.YoursSolutions/README.md
  87. +0 −71 TDDMicroExercises/CSharp/TDDMicroExercises.csproj
  88. +0 −20 TDDMicroExercises/CSharp/TDDMicroExercises.sln
  89. +0 −14 TDDMicroExercises/CSharp/TelemetrySystem.Tests/TelemetryDiagnosticControlsTest.cs
  90. +0 −93 TDDMicroExercises/CSharp/TelemetrySystem/TelemetryClient.cs
  91. +0 −46 TDDMicroExercises/CSharp/TelemetrySystem/TelemetryDiagnosticControls.cs
  92. +0 −9 TDDMicroExercises/CSharp/TirePressureMonitoringSystem.Tests/IAlarm.cs
  93. +0 −55 TDDMicroExercises/CSharp/TirePressureMonitoringSystem.Tests/MockAlarm.cs
  94. +0 −22 TDDMicroExercises/CSharp/TirePressureMonitoringSystem.Tests/StubAlarm.cs
  95. +0 −31 TDDMicroExercises/CSharp/TirePressureMonitoringSystem/Alarm.cs
  96. +0 −24 TDDMicroExercises/CSharp/TirePressureMonitoringSystem/Sensor.cs
  97. +0 −13 TDDMicroExercises/CSharp/TurnTicketDispenser/TicketDispenser.cs
  98. +0 −12 TDDMicroExercises/CSharp/TurnTicketDispenser/TurnNumberSequence.cs
  99. +0 −18 TDDMicroExercises/CSharp/TurnTicketDispenser/TurnTicket.cs
  100. +0 −34 TDDMicroExercises/CSharp/UnicodeFileToHtmTextConverter/UnicodeFileToHtmTextConverter.cs
  101. BIN  TDDMicroExercises/CSharp/lib/nunit.framework.dll
  102. +0 −6 TDDMicroExercises/Java/.gitignore
  103. +0 −15 TDDMicroExercises/Java/TelemetrySystem/pom.xml
  104. +0 −93 TDDMicroExercises/Java/TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/TelemetryClient.java
  105. +0 −44 ...cises/Java/TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/TelemetryDiagnosticControls.java
  106. +0 −13 ...s/Java/TelemetrySystem/src/test/java/tddmicroexercises/telemetrysystem/TelemetryDiagnosticControlsTest.java
  107. +0 −20 TDDMicroExercises/Java/TextConverter/pom.xml
  108. +0 −33 ...rcises/Java/TextConverter/src/main/java/tddmicroexercises/textconvertor/UnicodeFileToHtmlTextConverter.java
  109. +0 −15 TDDMicroExercises/Java/TirePressureMonitoringSystem/pom.xml
  110. +0 −28 ...s/Java/TirePressureMonitoringSystem/src/main/java/tddmicroexercises/tirepressuremonitoringsystem/Alarm.java
  111. +0 −8 .../Java/TirePressureMonitoringSystem/src/main/java/tddmicroexercises/tirepressuremonitoringsystem/IAlarm.java
  112. +0 −24 .../Java/TirePressureMonitoringSystem/src/main/java/tddmicroexercises/tirepressuremonitoringsystem/Sensor.java
  113. +0 −51 ...va/TirePressureMonitoringSystem/src/test/java/tddmicroexercises/tirepressuremonitoringsystem/MockAlarm.java
  114. +0 −23 ...va/TirePressureMonitoringSystem/src/test/java/tddmicroexercises/tirepressuremonitoringsystem/StubAlarm.java
  115. +0 −15 TDDMicroExercises/Java/TurnTicketDispenser/pom.xml
  116. +0 −12 ...Exercises/Java/TurnTicketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/TicketDispenser.java
  117. +0 −11 ...rcises/Java/TurnTicketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/TurnNumberSequence.java
  118. +0 −17 TDDMicroExercises/Java/TurnTicketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/TurnTicket.java
  119. +0 −1  TDDMicroExercises/Javascript/.gitignore
  120. +0 −2  TDDMicroExercises/Javascript/lib/.gitignore
  121. +0 −188 TDDMicroExercises/Javascript/lib/jasmine-html.js
  122. +0 −166 TDDMicroExercises/Javascript/lib/jasmine.css
  123. +0 −2,421 TDDMicroExercises/Javascript/lib/jasmine.js
  124. +0 −74 TDDMicroExercises/Javascript/lib/jsfake.js
  125. +0 −33 TDDMicroExercises/Javascript/spec.runner.html
  126. +0 −16 TDDMicroExercises/Javascript/telemetry-system-tests/telemetry-diagnostic-controls-test.js
  127. +0 −88 TDDMicroExercises/Javascript/telemetry-system/telemetry-client.js
  128. +0 −38 TDDMicroExercises/Javascript/telemetry-system/telemetry-diagnostic-controls.js
  129. +0 −14 TDDMicroExercises/Javascript/tire-pressure-monitoring-system-tests/alarm-test.js
  130. +0 −28 TDDMicroExercises/Javascript/tire-pressure-monitoring-system/alarm.js
  131. +0 −20 TDDMicroExercises/Javascript/tire-pressure-monitoring-system/sensor.js
  132. +0 −13 TDDMicroExercises/Javascript/turn-ticket-dispenser-tests/ticket-dispenser-test.js
  133. +0 −14 TDDMicroExercises/Javascript/turn-ticket-dispenser/ticket-dispenser.js
  134. +0 −8 TDDMicroExercises/Javascript/turn-ticket-dispenser/turn-number-sequence.js
  135. +0 −12 TDDMicroExercises/Javascript/turn-ticket-dispenser/turn-ticket.js
  136. +0 −13 ...croExercises/Javascript/unicode-file-to-htm-text-converter-tests/unicode-file-to-htm-text-converter-test.js
  137. +0 −71 TDDMicroExercises/Javascript/unicode-file-to-htm-text-converter/unicode-file-to-htm-text-converter.js
  138. +0 −28 TDDMicroExercises/README.md
  139. +0 −88 TDDMicroExercises/python/TelemetrySystem/telemetry.py
  140. BIN  TDDMicroExercises/python/TelemetrySystem/telemetry.pyc
  141. +0 −10 TDDMicroExercises/python/TelemetrySystem/test_telemetry.py
  142. +0 −16 TDDMicroExercises/python/TextConverter/unicode_to_html_converter.py
  143. BIN  TDDMicroExercises/python/TextConverter/unicode_to_html_converter.pyc
  144. +0 −49 TDDMicroExercises/python/TirePressureMonitoringSystem/test_tire_pressure_monitoring.py
  145. +0 −31 TDDMicroExercises/python/TirePressureMonitoringSystem/tire_pressure_monitoring.py
  146. +0 −18 TDDMicroExercises/python/TurnTicketDispenser/turn_ticket.py
View
BIN  Paper/mockobjects_emergingproperties.pdf
Binary file not shown
View
BIN  Paper/mockobjects_emergingproperties_finaldraft.pdf
Binary file not shown
View
17 Questionnaire/README.md
@@ -1,17 +0,0 @@
-# Questionnaire
-
-## [ENG]
-
-To start the questionnaire in English, [click here] (http://tool.surveypirate.com/Survey.aspx?surveyid=25731&sp.mac=DomDcdUgTB8gwbR5uWLCIg%3d%3d)
-
-But first send your solution of the [TDD micro-exercises] (https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples/tree/master/TDDMicroExercises).
-
-
-
-
-## [ITA]
-
-Per iniziare il questionario in Italiano, [clicca qui] (http://tool.surveypirate.com/Survey.aspx?surveyid=25808&sp.mac=yMAXSLB8yJuht8rRsJCdoA%3d%3d)
-
-Ma prima invia la tua soluzione dei [micro-esercizi di TDD] (https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples/tree/master/TDDMicroExercises).
-
View
11 README.md
@@ -1,11 +1,4 @@
-# TDD with Mock Objects: Design Principles and Emerging Properties
-Here you can find:
+If you're looking for starting code for the four Racing Car Katas, please look in this repo instead: [Racing-Car-Katas](https://github.com/emilybache/Racing-Car-Katas)
-- the [paper] (https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples/blob/master/Paper/mockobjects_emergingproperties.pdf?raw=true)
-- the [presentation] (https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples/blob/master/Slides/TDD-SOLID.pdf?raw=true)
-- the code of [TDD micro-exercises] (https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples/tree/master/TDDMicroExercises) (C#, JavaScript)
-- a [proposed solution] (https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples/tree/master/TDDMicroExercises.ProposedSolution)
-- share [your solution] (https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples/tree/master/TDDMicroExercises.YoursSolutions)
-
-The complete Java version of the TDD micro-exercises and of the proposed solution soon available, porting underway by [peterrhysthomas] (https://github.com/peterrhysthomas).
+If you're looking for information about Luca Minudel's study on TDD, please see his original repo: [TDDwithMockObjectsAndDesignPrinciples](https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples)
View
BIN  Slides/TDD-SOLID.pdf
Binary file not shown
View
83 TDDMicroExercises.ProposedSolution/CSharp/TDDMicroExercises.OneSolution.csproj
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.50727</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{BBCF3C67-8E31-48E3-AD2E-8C605E2E07BE}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>TDDMicroExercises.OneSolution</RootNamespace>
- <AssemblyName>TDDMicroExercises.OneSolution</AssemblyName>
- <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
- <FileUpgradeFlags>
- </FileUpgradeFlags>
- <OldToolsVersion>2.0</OldToolsVersion>
- <UpgradeBackupLocation />
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="nunit.framework, Version=2.4.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>lib\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Data" />
- <Reference Include="System.Web" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="TelemetrySystem.Tests\MockTelemetryDataChannel.cs" />
- <Compile Include="TelemetrySystem.Tests\TelemetryDiagnosticControlsTest.cs" />
- <Compile Include="TelemetrySystem.Tests\StubTelemetryConnection.cs" />
- <Compile Include="TelemetrySystem\IConnection.cs" />
- <Compile Include="TelemetrySystem\IDataChannel.cs" />
- <Compile Include="TelemetrySystem\TelemetryClientConnection.cs" />
- <Compile Include="TelemetrySystem\TelemetryDataChannel.cs" />
- <Compile Include="TelemetrySystem\TelemetryDiagnosticControls.cs" />
- <Compile Include="TirePressureMonitoringSystem.Tests\AlarmTest.cs" />
- <Compile Include="TirePressureMonitoringSystem.Tests\StubSensor.cs" />
- <Compile Include="TirePressureMonitoringSystem\Alarm.cs" />
- <Compile Include="TirePressureMonitoringSystem\ISensor.cs" />
- <Compile Include="TirePressureMonitoringSystem\Sensor.cs" />
- <Compile Include="TurnTicketDispenser\ITurnNumberSequence.cs" />
- <Compile Include="TurnTicketDispenser.Tests\MockTurnNumberSequence.cs" />
- <Compile Include="TurnTicketDispenser\TicketDispenser.cs" />
- <Compile Include="TurnTicketDispenser\TurnNumberSequence.cs" />
- <Compile Include="TurnTicketDispenser.Tests\TicketDispenserTest.cs" />
- <Compile Include="TurnTicketDispenser\TurnTicket.cs" />
- <Compile Include="UnicodeFileToHtmTextConverter\IUnicodeTextSource.cs" />
- <Compile Include="UnicodeFileToHtmTextConverter.Tests\StubUnicodeTextSource.cs" />
- <Compile Include="UnicodeFileToHtmTextConverter\UnicodeFileToHtmTextConverter.cs" />
- <Compile Include="UnicodeFileToHtmTextConverter.Tests\UnicodeFileToHtmTextConverterTest.cs" />
- <Compile Include="UnicodeFileToHtmTextConverter\UnicodeTextSourceFromFile.cs" />
- </ItemGroup>
- <ItemGroup>
- <Folder Include="Properties\" />
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
View
20 TDDMicroExercises.ProposedSolution/CSharp/TDDMicroExercises.OneSolution.sln
@@ -1,20 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TDDMicroExercises.OneSolution", "TDDMicroExercises.OneSolution.csproj", "{BBCF3C67-8E31-48E3-AD2E-8C605E2E07BE}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Release|Any CPU = Release|Any CPU
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {BBCF3C67-8E31-48E3-AD2E-8C605E2E07BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BBCF3C67-8E31-48E3-AD2E-8C605E2E07BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BBCF3C67-8E31-48E3-AD2E-8C605E2E07BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BBCF3C67-8E31-48E3-AD2E-8C605E2E07BE}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
View
54 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem.Tests/MockTelemetryDataChannel.cs
@@ -1,54 +0,0 @@
-using System;
-
-namespace TDDMicroExercises.OneSolution.TelemetrySystem.Tests
-{
- public class MockTelemetryDataChannel : IDataChannel
- {
- private string _extectedSendMessage;
- private string _actualSendMessage;
- private int _sendCallsCount = 0;
-
- private string _receiveReturnValue;
- private int _receiveCallsCount = 0;
-
- public void SetExpectedCallToSend(string extectedSendMessage)
- {
- _extectedSendMessage = extectedSendMessage;
- }
-
- public void SetExpectedCallToReceive(string returnValue)
- {
- _receiveReturnValue = returnValue;
- }
-
- public void Verify()
- {
- if (_sendCallsCount != 1)
- {
- throw new ArgumentOutOfRangeException("Send calls count", _sendCallsCount, "expected 1.");
- }
-
- if (_extectedSendMessage != _actualSendMessage)
- {
- throw new ArgumentOutOfRangeException("Send argument", _actualSendMessage, "expected '" + _extectedSendMessage + "'.");
- }
-
- if (_receiveCallsCount != 1)
- {
- throw new ArgumentOutOfRangeException("Receive calls count", _receiveCallsCount, "expected 1.");
- }
- }
-
- void IDataChannel.Send(string message)
- {
- _sendCallsCount += 1;
- _actualSendMessage = message;
- }
-
- string IDataChannel.Receive()
- {
- _receiveCallsCount += 1;
- return _receiveReturnValue;
- }
- }
-}
View
28 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem.Tests/StubTelemetryConnection.cs
@@ -1,28 +0,0 @@
-namespace TDDMicroExercises.OneSolution.TelemetrySystem.Tests
-{
- public class StubTelemetryConnection : IConnection
- {
- private bool _onlineStatus;
-
- public void StubGetOnlineStatus(bool returnValue)
- {
- _onlineStatus = returnValue;
- }
-
- bool IConnection.OnlineStatus
- {
- get { return _onlineStatus; }
- }
-
- void IConnection.Connect(string telemetryServerConnectionString)
- {
- return;
- }
-
- void IConnection.Disconnect()
- {
- return;
- }
-
- }
-}
View
29 ...xercises.ProposedSolution/CSharp/TelemetrySystem.Tests/TelemetryDiagnosticControlsTest.cs
@@ -1,29 +0,0 @@
-using NUnit.Framework;
-
-namespace TDDMicroExercises.OneSolution.TelemetrySystem.Tests
-{
- [TestFixture]
- public class TelemetryDiagnosticControlsTest
- {
- [Test]
- public void CheckTransmission_should_send_a_diagnostic_message_and_receive_a_status_message_response()
- {
- StubTelemetryConnection stubTelemetryConnection = new StubTelemetryConnection();
- stubTelemetryConnection.StubGetOnlineStatus(true);
-
- MockTelemetryDataChannel mockTelemetryDataChannel = new MockTelemetryDataChannel();
- mockTelemetryDataChannel.SetExpectedCallToSend(TelemetryDataChannel.DiagnosticMessage);
- mockTelemetryDataChannel.SetExpectedCallToReceive("status report");
-
- TelemetryDiagnosticControls target = new TelemetryDiagnosticControls(stubTelemetryConnection, mockTelemetryDataChannel);
-
-
- target.CheckTransmission();
-
-
- mockTelemetryDataChannel.Verify();
- Assert.AreEqual(target.DiagnosticInfo, "status report", "diagnostic info");
- }
-
- }
-}
View
10 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem/IConnection.cs
@@ -1,10 +0,0 @@
-namespace TDDMicroExercises.OneSolution.TelemetrySystem
-{
- public interface IConnection
- {
- bool OnlineStatus { get; }
-
- void Connect(string telemetryServerConnectionString);
- void Disconnect();
- }
-}
View
8 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem/IDataChannel.cs
@@ -1,8 +0,0 @@
-namespace TDDMicroExercises.OneSolution.TelemetrySystem
-{
- public interface IDataChannel
- {
- void Send(string message);
- string Receive();
- }
-}
View
33 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem/TelemetryClientConnection.cs
@@ -1,33 +0,0 @@
-using System;
-
-namespace TDDMicroExercises.OneSolution.TelemetrySystem
-{
- public class TelemetryClientConnection : IConnection
- {
- private bool _onlineStatus;
- private readonly Random _connectionEventsSimulator = new Random(42);
-
- public bool OnlineStatus
- {
- get { return _onlineStatus; }
- }
-
- public void Connect(string telemetryServerConnectionString)
- {
- if (string.IsNullOrEmpty(telemetryServerConnectionString))
- {
- throw new ArgumentNullException();
- }
-
- // simulate the operation on a real modem
- bool success = _connectionEventsSimulator.Next(1, 10) <= 8;
-
- _onlineStatus = success;
- }
-
- public void Disconnect()
- {
- _onlineStatus = false;
- }
- }
-}
View
67 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem/TelemetryDataChannel.cs
@@ -1,67 +0,0 @@
-using System;
-
-namespace TDDMicroExercises.OneSolution.TelemetrySystem
-{
- public class TelemetryDataChannel : IDataChannel
- {
- public const string DiagnosticMessage = "AT#UD";
-
- private string _diagnosticMessageResult = string.Empty;
- private readonly Random _connectionEventsSimulator = new Random(42);
-
- public void Send(string message)
- {
- if (string.IsNullOrEmpty(message))
- {
- throw new ArgumentNullException();
- }
-
- if (message == DiagnosticMessage)
- {
- // simulate a status report
- _diagnosticMessageResult =
- "LAST TX rate................ 100 MBPS\r\n"
- + "HIGHEST TX rate............. 100 MBPS\r\n"
- + "LAST RX rate................ 100 MBPS\r\n"
- + "HIGHEST RX rate............. 100 MBPS\r\n"
- + "BIT RATE.................... 100000000\r\n"
- + "WORD LEN.................... 16\r\n"
- + "WORD/FRAME.................. 511\r\n"
- + "BITS/FRAME.................. 8192\r\n"
- + "MODULATION TYPE............. PCM/FM\r\n"
- + "TX Digital Los.............. 0.75\r\n"
- + "RX Digital Los.............. 0.10\r\n"
- + "BEP Test.................... -5\r\n"
- + "Local Rtrn Count............ 00\r\n"
- + "Remote Rtrn Count........... 00";
-
- return;
- }
-
- // here should go the real Send operation
- }
-
- public string Receive()
- {
- string message;
-
- if (string.IsNullOrEmpty(_diagnosticMessageResult) == false)
- {
- message = _diagnosticMessageResult;
- _diagnosticMessageResult = string.Empty;
- }
- else
- {
- // simulate a received message
- message = string.Empty;
- int messageLenght = _connectionEventsSimulator.Next(50, 110);
- for(int i = messageLenght; i >=0; --i)
- {
- message += (char)_connectionEventsSimulator.Next(40, 126);
- }
- }
-
- return message;
- }
- }
-}
View
57 TDDMicroExercises.ProposedSolution/CSharp/TelemetrySystem/TelemetryDiagnosticControls.cs
@@ -1,57 +0,0 @@
-using System;
-
-namespace TDDMicroExercises.OneSolution.TelemetrySystem
-{
- public class TelemetryDiagnosticControls
- {
- private const string DiagnosticChannelConnectionString = "*111#";
-
- private readonly IConnection _connection;
- private readonly IDataChannel _dataChannel;
-
- private string _diagnosticInfo = string.Empty;
-
-
- public TelemetryDiagnosticControls(IConnection connection, IDataChannel dataChannel)
- {
- _connection = connection;
- _dataChannel = dataChannel;
- }
-
-
- public TelemetryDiagnosticControls()
- : this(new TelemetryClientConnection(), new TelemetryDataChannel())
- {
- }
-
-
- public string DiagnosticInfo
- {
- get { return _diagnosticInfo; }
- set { _diagnosticInfo = value; }
- }
-
- public void CheckTransmission()
- {
- _diagnosticInfo = string.Empty;
-
- _connection.Disconnect();
-
- int retryLeft = 3;
- while (_connection.OnlineStatus == false && retryLeft > 0)
- {
- _connection.Connect(DiagnosticChannelConnectionString);
- retryLeft -= 1;
- }
-
- if (_connection.OnlineStatus == false)
- {
- throw new Exception("Unable to connect.");
- }
-
- _dataChannel.Send(TelemetryDataChannel.DiagnosticMessage);
- _diagnosticInfo = _dataChannel.Receive();
- _connection.Disconnect();
- }
- }
-}
View
46 TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem.Tests/AlarmTest.cs
@@ -1,46 +0,0 @@
-using NUnit.Framework;
-
-namespace TDDMicroExercises.OneSolution.TirePressureMonitoringSystem.Tests
-{
- [TestFixture]
- public class AlarmTest
- {
- [Test]
- public void a_normal_pressure_value_should_not_raise_the_alarm()
- {
- StubSensor stubSensor = new StubSensor();
- stubSensor.StubCallToPopNextPressurePsiValue(Alarm.LowPressureTreshold);
- Alarm target = new Alarm(stubSensor);
-
- target.Check();
-
- Assert.AreEqual(false, target.AlarmOn, "alarm on");
- }
-
- [Test]
- public void a_pressure_value_out_of_range_should_raise_the_alarm()
- {
- StubSensor stubSensor = new StubSensor();
- stubSensor.StubCallToPopNextPressurePsiValue(Alarm.LowPressureTreshold -1);
- Alarm target = new Alarm(stubSensor);
-
- target.Check();
-
- Assert.AreEqual(true, target.AlarmOn, "alarm on");
- }
-
- [Test]
- public void a_normal_pressure_value_after_an_out_of_range_pressure_value_should_keep_the_alarm_on()
- {
- StubSensor stubSensor = new StubSensor();
- stubSensor.StubCallToPopNextPressurePsiValues(new double[] { Alarm.LowPressureTreshold, Alarm.LowPressureTreshold - 1, Alarm.LowPressureTreshold });
- Alarm target = new Alarm(stubSensor);
-
- target.Check();
- target.Check();
- target.Check();
-
- Assert.AreEqual(true, target.AlarmOn, "alarm on");
- }
- }
-}
View
28 TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem.Tests/StubSensor.cs
@@ -1,28 +0,0 @@
-
-using System.Collections.Generic;
-
-namespace TDDMicroExercises.OneSolution.TirePressureMonitoringSystem.Tests
-{
- public class StubSensor : ISensor
- {
- private readonly Stack<double> _returnedValues = new Stack<double>();
-
- public void StubCallToPopNextPressurePsiValue(double returnedValue)
- {
- StubCallToPopNextPressurePsiValues(new double[] { returnedValue });
- }
-
- public void StubCallToPopNextPressurePsiValues(double[] returnedValues)
- {
- foreach (double expectedValue in returnedValues)
- {
- _returnedValues.Push(expectedValue);
- }
- }
-
- double ISensor.PopNextPressurePsiValue()
- {
- return _returnedValues.Pop();
- }
- }
-}
View
40 TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem/Alarm.cs
@@ -1,40 +0,0 @@
-namespace TDDMicroExercises.OneSolution.TirePressureMonitoringSystem
-{
- public class Alarm
- {
- public const double LowPressureTreshold = 17;
- public const double HighPressureTreshold = 21;
-
- ISensor _sensor;
-
- bool _alarmOn = false;
- private long _alarmCount = 0;
-
-
- public Alarm() : this(new Sensor())
- {
- }
-
- public Alarm(ISensor sensor)
- {
- _sensor = sensor;
- }
-
- public void Check()
- {
- double psiPressureValue = _sensor.PopNextPressurePsiValue();
-
- if (psiPressureValue < LowPressureTreshold || HighPressureTreshold < psiPressureValue)
- {
- _alarmOn = true;
- _alarmCount += 1;
- }
- }
-
- public bool AlarmOn
- {
- get { return _alarmOn; }
- }
-
- }
-}
View
7 TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem/ISensor.cs
@@ -1,7 +0,0 @@
-namespace TDDMicroExercises.OneSolution.TirePressureMonitoringSystem
-{
- public interface ISensor
- {
- double PopNextPressurePsiValue();
- }
-}
View
24 TDDMicroExercises.ProposedSolution/CSharp/TirePressureMonitoringSystem/Sensor.cs
@@ -1,24 +0,0 @@
-using System;
-
-namespace TDDMicroExercises.OneSolution.TirePressureMonitoringSystem
-{
- public class Sensor : ISensor
- {
- const double Offset = 16;
-
- public double PopNextPressurePsiValue()
- {
- double pressureTelemetryValue;
- SamplePressure(out pressureTelemetryValue);
-
- return Offset + pressureTelemetryValue;
- }
-
- private static void SamplePressure(out double pressureTelemetryValue)
- {
- // placeholder implementation that simulate a real sensor in a real tire
- Random basicRandomNumbersGenerator = new Random(42);
- pressureTelemetryValue = 6 * basicRandomNumbersGenerator.NextDouble() * basicRandomNumbersGenerator.NextDouble();
- }
- }
-}
View
32 ...icroExercises.ProposedSolution/CSharp/TurnTicketDispenser.Tests/MockTurnNumberSequence.cs
@@ -1,32 +0,0 @@
-using System;
-
-namespace TDDMicroExercises.OneSolution.TurnTicketDispenser.Tests
-{
- class MockTurnNumberSequence : ITurnNumberSequence
- {
- private int _expectedNextTurnNumber;
- private int _callsCount = 0;
-
-
- public void SetExpectedGetNextTurnNumber(int expectedNextTurnNumber)
- {
- _expectedNextTurnNumber = expectedNextTurnNumber;
- }
-
- public void Verify()
- {
- if (_callsCount != 1)
- {
- throw new ArgumentOutOfRangeException("GetNextTurnNumber call count", _callsCount, "expected 1.");
- }
- }
-
- int ITurnNumberSequence.GetNextTurnNumber()
- {
- _callsCount++;
- return _expectedNextTurnNumber;
- }
-
-
- }
-}
View
44 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser.Tests/TicketDispenserTest.cs
@@ -1,44 +0,0 @@
-using NUnit.Framework;
-
-namespace TDDMicroExercises.OneSolution.TurnTicketDispenser.Tests
-{
- [TestFixture]
- public class TicketDispenserTest
- {
- [Test]
- public void A_new_ticket_must_have_the_turn_number_subsequent_to_the_previous_ticket()
- {
- TicketDispenser ticketDispenser = new TicketDispenser();
- TurnTicket previousTicket = ticketDispenser.GetTurnTicket();
-
- TurnTicket newTicket = ticketDispenser.GetTurnTicket();
-
- Assert.Greater(newTicket.TurnNumber, previousTicket.TurnNumber, "turn number");
- }
-
- [Test]
- public void A_new_ticket_must_have_the_turn_number_subsequent_to_the_previous_ticket_from_another_dispencer()
- {
- TicketDispenser firstTicketDispenser = new TicketDispenser();
- TurnTicket previousTicket = firstTicketDispenser.GetTurnTicket();
-
- TicketDispenser secondTicketDispenser = new TicketDispenser();
- TurnTicket newTicket = secondTicketDispenser.GetTurnTicket();
-
- Assert.Greater(newTicket.TurnNumber, previousTicket.TurnNumber, "turn number");
- }
-
- [Test]
- public void After_ticket_10_come_ticket_11()
- {
- MockTurnNumberSequence mockTurnNumberSequence = new MockTurnNumberSequence();
- mockTurnNumberSequence.SetExpectedGetNextTurnNumber(11);
- TicketDispenser ticketDispenser = new TicketDispenser(mockTurnNumberSequence);
-
- TurnTicket newTicket = ticketDispenser.GetTurnTicket();
-
- Assert.AreEqual(11, newTicket.TurnNumber, "turn number");
- mockTurnNumberSequence.Verify();
- }
- }
-}
View
7 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser/ITurnNumberSequence.cs
@@ -1,7 +0,0 @@
-namespace TDDMicroExercises.OneSolution.TurnTicketDispenser
-{
- public interface ITurnNumberSequence
- {
- int GetNextTurnNumber();
- }
-}
View
25 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser/TicketDispenser.cs
@@ -1,25 +0,0 @@
-namespace TDDMicroExercises.OneSolution.TurnTicketDispenser
-{
- public class TicketDispenser
- {
- ITurnNumberSequence turnNumberSequence;
-
- public TicketDispenser() : this(TurnNumberSequence.GlobalTurnNumberSequence)
- {
- }
-
-
- public TicketDispenser(ITurnNumberSequence turnNumberSequence)
- {
- this.turnNumberSequence = turnNumberSequence;
- }
-
- public TurnTicket GetTurnTicket()
- {
- int newTurnNumber = turnNumberSequence.GetNextTurnNumber();
- TurnTicket newTurnTicket = new TurnTicket(newTurnNumber);
-
- return newTurnTicket;
- }
- }
-}
View
14 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser/TurnNumberSequence.cs
@@ -1,14 +0,0 @@
-namespace TDDMicroExercises.OneSolution.TurnTicketDispenser
-{
- public class TurnNumberSequence : ITurnNumberSequence
- {
- public static readonly TurnNumberSequence GlobalTurnNumberSequence = new TurnNumberSequence();
-
- private int _turnNumber = 0;
-
- public int GetNextTurnNumber()
- {
- return _turnNumber++;
- }
- }
-}
View
18 TDDMicroExercises.ProposedSolution/CSharp/TurnTicketDispenser/TurnTicket.cs
@@ -1,18 +0,0 @@
-namespace TDDMicroExercises.OneSolution.TurnTicketDispenser
-{
- public class TurnTicket
- {
- private readonly int _turnNumber;
-
- public TurnTicket(int turnNumber)
- {
- _turnNumber = turnNumber;
- }
-
- public int TurnNumber
- {
- get { return _turnNumber; }
- }
-
- }
-}
View
19 ...ises.ProposedSolution/CSharp/UnicodeFileToHtmTextConverter.Tests/StubUnicodeTextSource.cs
@@ -1,19 +0,0 @@
-using System.IO;
-
-namespace TDDMicroExercises.OneSolution.UnicodeFileToHtmTextConverter.Tests
-{
- public class StubUnicodeTextSource : IUnicodeTextSource
- {
- private string _text;
-
- public void StubCallToGetTextReader(string returnedText)
- {
- _text = returnedText;
- }
-
- TextReader IUnicodeTextSource.GetTextReader()
- {
- return new StringReader(_text);
- }
- }
-}
View
45 ...dSolution/CSharp/UnicodeFileToHtmTextConverter.Tests/UnicodeFileToHtmTextConverterTest.cs
@@ -1,45 +0,0 @@
-using NUnit.Framework;
-
-namespace TDDMicroExercises.OneSolution.UnicodeFileToHtmTextConverter.Tests
-{
- [TestFixture]
- public class UnicodeFileToHtmTextConverterTest
- {
- [Test]
- public void should_convert_ampersand()
- {
- StubUnicodeTextSource stubSource = new StubUnicodeTextSource();
- stubSource.StubCallToGetTextReader("Cut & Paste");
-
- UnicodeFileToHtmTextConverter target = new UnicodeFileToHtmTextConverter(stubSource);
- string result = target.ConvertToHtml();
-
- Assert.AreEqual(result, "Cut &amp; Paste<br />", "html converted text");
- }
-
- [Test]
- public void should_convert_greate_than_and_less_than()
- {
- StubUnicodeTextSource stubSource = new StubUnicodeTextSource();
- stubSource.StubCallToGetTextReader("10 > 5; 5 < 10");
-
- UnicodeFileToHtmTextConverter target = new UnicodeFileToHtmTextConverter(stubSource);
- string result = target.ConvertToHtml();
-
- Assert.AreEqual(result, "10 &gt; 5; 5 &lt; 10<br />", "html converted text");
- }
-
- [Test]
- public void should_add_breakline_for_multiple_lines()
- {
- StubUnicodeTextSource stubSource = new StubUnicodeTextSource();
- stubSource.StubCallToGetTextReader("hello\nhow are you doing?");
-
- UnicodeFileToHtmTextConverter target = new UnicodeFileToHtmTextConverter(stubSource);
- string result = target.ConvertToHtml();
-
- Assert.AreEqual(result, "hello</b>how are you doing?<br />", "html converted text");
- }
-
- }
-}
View
9 ...icroExercises.ProposedSolution/CSharp/UnicodeFileToHtmTextConverter/IUnicodeTextSource.cs
@@ -1,9 +0,0 @@
-using System.IO;
-
-namespace TDDMicroExercises.OneSolution.UnicodeFileToHtmTextConverter
-{
- public interface IUnicodeTextSource
- {
- TextReader GetTextReader();
- }
-}
View
38 ...es.ProposedSolution/CSharp/UnicodeFileToHtmTextConverter/UnicodeFileToHtmTextConverter.cs
@@ -1,38 +0,0 @@
-using System.IO;
-using System.Web;
-
-namespace TDDMicroExercises.OneSolution.UnicodeFileToHtmTextConverter
-{
- public class UnicodeFileToHtmTextConverter
- {
- private IUnicodeTextSource _textSource;
-
- public UnicodeFileToHtmTextConverter(string fullFilenameWithPath)
- : this (new UnicodeTextSourceFromFile(fullFilenameWithPath))
- {
- }
-
- public UnicodeFileToHtmTextConverter(IUnicodeTextSource textSource)
- {
- _textSource = textSource;
- }
-
- public string ConvertToHtml()
- {
- using (TextReader unicodeFileStream = _textSource.GetTextReader())
- {
- string html = string.Empty;
-
- string line = unicodeFileStream.ReadLine();
- while (line != null)
- {
- html += HttpUtility.HtmlEncode(line);
- html += "<br />";
- line = unicodeFileStream.ReadLine();
- }
-
- return html;
- }
- }
- }
-}
View
20 ...rcises.ProposedSolution/CSharp/UnicodeFileToHtmTextConverter/UnicodeTextSourceFromFile.cs
@@ -1,20 +0,0 @@
-using System.IO;
-
-namespace TDDMicroExercises.OneSolution.UnicodeFileToHtmTextConverter
-{
- public class UnicodeTextSourceFromFile : IUnicodeTextSource
- {
- private string _fullFilenameWithPath;
-
- public UnicodeTextSourceFromFile(string fullFilenameWithPath)
- {
- _fullFilenameWithPath = fullFilenameWithPath;
- }
-
- public TextReader GetTextReader()
- {
- return File.OpenText(_fullFilenameWithPath);
-
- }
- }
-}
View
BIN  TDDMicroExercises.ProposedSolution/CSharp/lib/nunit.framework.dll
Binary file not shown
View
6 TDDMicroExercises.ProposedSolution/Java/.gitignore
@@ -1,6 +0,0 @@
-target/
-bin/
-.settings/
-.project
-.classpath
-.DS_Store
View
15 TDDMicroExercises.ProposedSolution/Java/TelemetrySystem/pom.xml
@@ -1,15 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>TelemetrySystem</groupId>
- <artifactId>TelemetrySystem</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.9</version>
- <type>jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
View
10 ...ion/Java/TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/IConnection.java
@@ -1,10 +0,0 @@
-package tddmicroexercises.telemetrysystem;
-
-public interface IConnection {
-
- void disconnect();
-
- boolean getOnlineStatus();
-
- void connect(String diagnosticChannelConnectionString);
-}
View
10 ...on/Java/TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/IDataChannel.java
@@ -1,10 +0,0 @@
-package tddmicroexercises.telemetrysystem;
-
-public interface IDataChannel {
-
- public static final String DIAGNOSTIC_MESSAGE = "AT#UD";
-
- void send(String diagnosticMessage);
-
- String receive();
-}
View
34 .../TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/TelemetryConnection.java
@@ -1,34 +0,0 @@
-package tddmicroexercises.telemetrysystem;
-
-import java.util.Random;
-
-public class TelemetryConnection implements IConnection
-{
- private final Random connectionEventsSimulator = new Random(42);
-
- private boolean onlineStatus;
-
- public boolean getOnlineStatus()
- {
- return onlineStatus;
- }
-
- public void connect(String telemetryServerConnectionString)
- {
- if (telemetryServerConnectionString == null || "".equals(telemetryServerConnectionString))
- {
- throw new IllegalArgumentException();
- }
-
- // simulate the operation on a real modem
- boolean success = connectionEventsSimulator.nextInt(10) <= 8;
-
- onlineStatus = success;
- }
-
- public void disconnect()
- {
- onlineStatus = false;
- }
-}
-
View
67 ...TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/TelemetryDataChannel.java
@@ -1,67 +0,0 @@
-package tddmicroexercises.telemetrysystem;
-
-import java.util.Random;
-
-public class TelemetryDataChannel implements IDataChannel {
-
- private String diagnosticMessageResult = "";
-
- private final Random connectionEventsSimulator = new Random(42);
-
- public void send(String message)
- {
- if (message == null || "".equals(message))
- {
- throw new IllegalArgumentException();
- }
-
- if (message == IDataChannel.DIAGNOSTIC_MESSAGE)
- {
- // simulate a status report
- diagnosticMessageResult =
- "LAST TX rate................ 100 MBPS\r\n"
- + "HIGHEST TX rate............. 100 MBPS\r\n"
- + "LAST RX rate................ 100 MBPS\r\n"
- + "HIGHEST RX rate............. 100 MBPS\r\n"
- + "BIT RATE.................... 100000000\r\n"
- + "WORD LEN.................... 16\r\n"
- + "WORD/FRAME.................. 511\r\n"
- + "BITS/FRAME.................. 8192\r\n"
- + "MODULATION TYPE............. PCM/FM\r\n"
- + "TX Digital Los.............. 0.75\r\n"
- + "RX Digital Los.............. 0.10\r\n"
- + "BEP Test.................... -5\r\n"
- + "Local Rtrn Count............ 00\r\n"
- + "Remote Rtrn Count........... 00";
-
- return;
- }
-
- // here should go the real Send operation
- }
-
- public String receive()
- {
- String message;
-
- if (diagnosticMessageResult == null || "".equals(diagnosticMessageResult))
- {
- // simulate a received message
- message = "";
- int messageLength = connectionEventsSimulator.nextInt(50) + 60;
- for(int i = messageLength; i >=0; --i)
- {
- message += (char)connectionEventsSimulator.nextInt(40) + 86;
- }
-
- }
- else
- {
- message = diagnosticMessageResult;
- diagnosticMessageResult = "";
- }
-
- return message;
- }
-
-}
View
48 ...rySystem/src/main/java/tddmicroexercises/telemetrysystem/TelemetryDiagnosticControls.java
@@ -1,48 +0,0 @@
-package tddmicroexercises.telemetrysystem;
-
-import java.net.ConnectException;
-
-public class TelemetryDiagnosticControls
-{
- public static final String CONNECTION_STRING = "*111#";
-
- private final IConnection connection;
- private final IDataChannel dataChannel;
- private String diagnosticInfo = "";
-
- public TelemetryDiagnosticControls(){
- this(new TelemetryConnection(), new TelemetryDataChannel());
- }
-
- public TelemetryDiagnosticControls(IConnection connection, IDataChannel dataChannel) {
- this.connection = connection;
- this.dataChannel = dataChannel;
- }
-
- public String getDiagnosticInfo(){
- return diagnosticInfo;
- }
-
- public void setDiagnosticInfo(String diagnosticInfo){
- this.diagnosticInfo = diagnosticInfo;
- }
-
- public void checkTransmission() throws Exception{
- diagnosticInfo = "";
-
- connection.disconnect();
-
- int retryLeft = 3;
- while (connection.getOnlineStatus() == false && retryLeft > 0){
- connection.connect(CONNECTION_STRING);
- retryLeft -= 1;
- }
-
- if(connection.getOnlineStatus() == false){
- throw new ConnectException("Unable to connect.");
- }
-
- dataChannel.send(IDataChannel.DIAGNOSTIC_MESSAGE);
- diagnosticInfo = dataChannel.receive();
- }
-}
View
38 ...emetrySystem/src/test/java/tddmicroexercises/telemetrysystem/TelemetryConnectionMock.java
@@ -1,38 +0,0 @@
-package tddmicroexercises.telemetrysystem;
-
-public class TelemetryConnectionMock implements IConnection {
-
- private boolean onlineStatus;
- private int connectCallCount = 0;
- private int disconnectCallCount;
- private String connectString;
-
- public void disconnect() {
- disconnectCallCount++;
- }
-
- public boolean getOnlineStatus() {
- return onlineStatus;
- }
-
- public void connect(String string) {
- connectString = string;
- connectCallCount++;
- }
-
- public void setOnlineStatus(boolean status) {
- this.onlineStatus = status;
- }
-
- public int getConnectCallCount() {
- return connectCallCount ;
- }
-
- public int getDisconnectCallCount() {
- return disconnectCallCount;
- }
-
- public String getConnectString() {
- return connectString;
- }
-}
View
24 ...metrySystem/src/test/java/tddmicroexercises/telemetrysystem/TelemetryDataChannelMock.java
@@ -1,24 +0,0 @@
-package tddmicroexercises.telemetrysystem;
-
-
-public class TelemetryDataChannelMock implements IDataChannel {
-
- private String diagnosticMessage;
- private String sentMessage = "";
-
- public void send(String diagnosticMessage) {
- sentMessage = diagnosticMessage;
- }
-
- public String receive() {
- return diagnosticMessage;
- }
-
- public void setDiagnosticMessage(String diagnosticMessage) {
- this.diagnosticMessage = diagnosticMessage;
- }
-
- public boolean hasSentMessage(String message) {
- return sentMessage.equals(message);
- }
-}
View
18 ...est/java/tddmicroexercises/telemetrysystem/TelemetryDiagnosticControlsCoveringsTests.java
@@ -1,18 +0,0 @@
-package tddmicroexercises.telemetrysystem;
-
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-
-public class TelemetryDiagnosticControlsCoveringsTests{
- @Test
- // Regression test to ensure existing API is not broken
- public void checkTransmissionShouldSetDiagnosticInfo() throws Exception{
- TelemetryDiagnosticControls controls = new TelemetryDiagnosticControls();
-
- controls.checkTransmission();
-
- assertNotNull(controls.getDiagnosticInfo());
- }
-
-}
View
33 ...stem/src/test/java/tddmicroexercises/telemetrysystem/TelemetryDiagnosticControlsTest.java
@@ -1,33 +0,0 @@
-package tddmicroexercises.telemetrysystem;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class TelemetryDiagnosticControlsTest{
-
- private TelemetryConnectionMock telemetryConnectionMock;
- private TelemetryDataChannelMock telemetryDataChannelMock;
- private TelemetryDiagnosticControls controls;
-
- @Before
- public void setUp(){
- telemetryConnectionMock = new TelemetryConnectionMock();
- telemetryDataChannelMock = new TelemetryDataChannelMock();
- controls = new TelemetryDiagnosticControls(telemetryConnectionMock, telemetryDataChannelMock);
- }
-
- @Test
- public void shouldSendADiagnosticMessageAndReceiveAStatusMessageResponse() throws Exception{
- telemetryConnectionMock.setOnlineStatus(true);
- String diagnosticInfo = "Diagnostic Message";
- telemetryDataChannelMock.setDiagnosticMessage(diagnosticInfo);
-
- controls.checkTransmission();
-
- assertTrue(telemetryDataChannelMock.hasSentMessage(IDataChannel.DIAGNOSTIC_MESSAGE));
- assertEquals(diagnosticInfo,controls.getDiagnosticInfo());
- }
-}
View
20 TDDMicroExercises.ProposedSolution/Java/TextConverter/pom.xml
@@ -1,20 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>TextConverter</groupId>
- <artifactId>TextConverter </artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.9</version>
- <type>jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
- <version>2.2</version>
- </dependency>
- </dependencies>
-</project>
View
20 ...va/TextConverter/src/main/java/tddmicroexercises/textconvertor/FileUnicodeDataSource.java
@@ -1,20 +0,0 @@
-package tddmicroexercises.textconvertor;
-
-import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-
-public class FileUnicodeDataSource implements UnicodeDataSource {
-
- private BufferedReader reader;
-
- public FileUnicodeDataSource(String fullFilenameWithPath) throws FileNotFoundException {
- reader = new BufferedReader(new FileReader(fullFilenameWithPath));
- }
-
- public String readLine() throws IOException {
- return reader.readLine();
- }
-
-}
View
9 ...n/Java/TextConverter/src/main/java/tddmicroexercises/textconvertor/UnicodeDataSource.java
@@ -1,9 +0,0 @@
-package tddmicroexercises.textconvertor;
-
-import java.io.IOException;
-
-public interface UnicodeDataSource {
-
- String readLine() throws IOException;
-
-}
View
32 ...nverter/src/main/java/tddmicroexercises/textconvertor/UnicodeFileToHtmlTextConverter.java
@@ -1,32 +0,0 @@
-package tddmicroexercises.textconvertor;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-import org.apache.commons.lang.StringEscapeUtils;
-
-public class UnicodeFileToHtmlTextConverter
-{
- private UnicodeDataSource reader;
-
- public UnicodeFileToHtmlTextConverter(String fullFilenameWithPath) throws FileNotFoundException
- {
- reader = new FileUnicodeDataSource(fullFilenameWithPath);
- }
-
- public UnicodeFileToHtmlTextConverter(UnicodeDataSource reader) {
- this.reader = reader;
- }
-
- public String convertToHtml() throws IOException{
- String line = reader.readLine();
- String html = "";
- while (line != null)
- {
- html += StringEscapeUtils.escapeHtml(line);
- html += "<br />";
- line = reader.readLine();
- }
- return html;
- }
-}
View
4 TDDMicroExercises.ProposedSolution/Java/TextConverter/src/test/java/data.txt
@@ -1,4 +0,0 @@
-hello
-mum&dad
-less<than
-greater>than
View
23 ...va/TextConverter/src/test/java/tddmicroexercises/textconvertor/UnicodeDataSourceStub.java
@@ -1,23 +0,0 @@
-package tddmicroexercises.textconvertor;
-
-import java.io.IOException;
-import java.util.Stack;
-
-
-public class UnicodeDataSourceStub implements UnicodeDataSource {
-
- private Stack<String> values = new Stack<String>();
-
- public String readLine() throws IOException {
- if(values.isEmpty()){
- return null;
- } else {
- return values.pop();
- }
- }
-
- public void setLine(String string) {
- values.push(string);
- }
-
-}
View
18 ...st/java/tddmicroexercises/textconvertor/UnicodeFileToHtmlTextConverterCoveringsTests.java
@@ -1,18 +0,0 @@
-package tddmicroexercises.textconvertor;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.junit.Test;
-
-public class UnicodeFileToHtmlTextConverterCoveringsTests {
-
- @Test
- // Regression test to ensure existing API is not broken
- public void shouldConvertFileContentsToHtmlEscapedString() throws IOException {
- String fullFilenameWithPath = this.getClass().getClassLoader().getResource("data.txt").getPath();
- UnicodeFileToHtmlTextConverter converter = new UnicodeFileToHtmlTextConverter(fullFilenameWithPath);
- assertEquals("hello<br />mum&amp;dad<br />less&lt;than<br />greater&gt;than<br />",converter.convertToHtml());
- }
-}
View
35 ...er/src/test/java/tddmicroexercises/textconvertor/UnicodeFileToHtmlTextConverterTests.java
@@ -1,35 +0,0 @@
-package tddmicroexercises.textconvertor;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.IOException;
-
-import org.junit.Test;
-
-public class UnicodeFileToHtmlTextConverterTests {
-
- @Test
- public void shouldEscapeAmpersand() throws IOException{
- UnicodeDataSourceStub stubReader = new UnicodeDataSourceStub();
- stubReader.setLine("mum&dad");
- UnicodeFileToHtmlTextConverter converter = new UnicodeFileToHtmlTextConverter(stubReader);
- assertEquals("mum&amp;dad<br />", converter.convertToHtml());
- }
-
- @Test
- public void shouldEscapeLessThanAndGreaterThan() throws IOException{
- UnicodeDataSourceStub stubReader = new UnicodeDataSourceStub();
- stubReader.setLine("lessthan< greaterthan>");
- UnicodeFileToHtmlTextConverter converter = new UnicodeFileToHtmlTextConverter(stubReader);
- assertEquals("lessthan&lt; greaterthan&gt;<br />", converter.convertToHtml());
- }
-
- @Test
- public void shouldAddLineBreakAtEndOfEveryInputLine() throws IOException{
- UnicodeDataSourceStub stubReader = new UnicodeDataSourceStub();
- stubReader.setLine("hello");
- stubReader.setLine("mum dad");
- UnicodeFileToHtmlTextConverter converter = new UnicodeFileToHtmlTextConverter(stubReader);
- assertEquals("mum dad<br />hello<br />", converter.convertToHtml());
- }
-}
View
15 TDDMicroExercises.ProposedSolution/Java/TirePressureMonitoringSystem/pom.xml
@@ -1,15 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>TirePressureMonitoringSystem</groupId>
- <artifactId>TirePressureMonitoringSystem </artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.9</version>
- <type>jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
View
34 ...eMonitoringSystem/src/main/java/tddmicroexercises/tirepressuremonitoringsystem/Alarm.java
@@ -1,34 +0,0 @@
-package tddmicroexercises.tirepressuremonitoringsystem;
-
-public class Alarm
-{
- public static final double LOW_PRESSURE_THRESHOLD = 17;
- public static final double HIGH_PRESSURE_THRESHOLD = 21;
-
- ISensor sensor;
-
- boolean alarmOn = false;
-
- public Alarm(){
- this(new Sensor());
- }
-
- public Alarm(ISensor sensor) {
- this.sensor = sensor;
- }
-
- public void check()
- {
- double psiPressureValue = sensor.popNextPressurePsiValue();
-
- if (psiPressureValue < LOW_PRESSURE_THRESHOLD || HIGH_PRESSURE_THRESHOLD < psiPressureValue)
- {
- alarmOn = true;
- }
- }
-
- public boolean isAlarmOn()
- {
- return alarmOn;
- }
-}
View
7 ...onitoringSystem/src/main/java/tddmicroexercises/tirepressuremonitoringsystem/ISensor.java
@@ -1,7 +0,0 @@
-package tddmicroexercises.tirepressuremonitoringsystem;
-
-public interface ISensor {
-
- double popNextPressurePsiValue();
-
-}
View
24 ...MonitoringSystem/src/main/java/tddmicroexercises/tirepressuremonitoringsystem/Sensor.java
@@ -1,24 +0,0 @@
-package tddmicroexercises.tirepressuremonitoringsystem;
-
-import java.util.Random;
-
-public class Sensor implements ISensor
-{
- public static final double OFFSET = 16;
-
- public double popNextPressurePsiValue()
- {
- double pressureTelemetryValue;
- pressureTelemetryValue = samplePressure( );
-
- return OFFSET + pressureTelemetryValue;
- }
-
- private static double samplePressure()
- {
- // placeholder implementation that simulate a real sensor in a real tire
- Random basicRandomNumbersGenerator = new Random(42);
- double pressureTelemetryValue = 6 * basicRandomNumbersGenerator.nextDouble() * basicRandomNumbersGenerator.nextDouble();
- return pressureTelemetryValue;
- }
-}
View
54 ...toringSystem/src/test/java/tddmicroexercises/tirepressuremonitoringsystem/AlarmTests.java
@@ -1,54 +0,0 @@
-package tddmicroexercises.tirepressuremonitoringsystem;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class AlarmTests {
-
- private static final double HIGH_PRESSURE = Alarm.HIGH_PRESSURE_THRESHOLD + 1;
- private static final double LOW_PRESSURE = Alarm.LOW_PRESSURE_THRESHOLD - 1;
- private static final double NORMAL_PRESSURE = Alarm.LOW_PRESSURE_THRESHOLD + ((Alarm.HIGH_PRESSURE_THRESHOLD - Alarm.LOW_PRESSURE_THRESHOLD)/2);
- private StubSensor stubSensor;
- private Alarm alarm;
-
- @Before
- public void setUp(){
- stubSensor = new StubSensor();
- alarm = new Alarm(stubSensor);
- }
-
- @Test
- public void alarmIsTriggeredBySensorReadingBelowLowPressureValue() {
- stubSensor.pushPsiValue(LOW_PRESSURE);
- alarm.check();
- assertTrue(alarm.isAlarmOn());
- }
-
- @Test
- public void alarmIsTriggeredBySensorReadingAboveHighPressureValue() {
- stubSensor.pushPsiValue(HIGH_PRESSURE);
- alarm.check();
- assertTrue(alarm.isAlarmOn());
- }
-
- @Test
- public void alarmIsNotTriggeredBySensorReadingANormalPresureValue(){
- double pressureValue = NORMAL_PRESSURE;
- stubSensor.pushPsiValue(pressureValue);
- alarm.check();
- assertFalse(alarm.isAlarmOn());
- }
-
- @Test
- public void alarmRemainsOnAfterTriggering(){
- stubSensor.pushPsiValue(HIGH_PRESSURE);
- alarm.check();
- assertTrue(alarm.isAlarmOn());
- stubSensor.pushPsiValue(NORMAL_PRESSURE);
- alarm.check();
- assertTrue(alarm.isAlarmOn());
- }
-}
View
18 ...toringSystem/src/test/java/tddmicroexercises/tirepressuremonitoringsystem/StubSensor.java
@@ -1,18 +0,0 @@
-package tddmicroexercises.tirepressuremonitoringsystem;
-
-import java.util.Stack;
-
-public class StubSensor implements ISensor {
-
- private Stack<Double> values = new Stack<Double>();
-
- public double popNextPressurePsiValue() {
- return values.pop();
- }
-
- public void pushPsiValue(double d) {
- values.push(d);
-
- }
-
-}
View
15 TDDMicroExercises.ProposedSolution/Java/TurnTicketDispenser/pom.xml
@@ -1,15 +0,0 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>TurnTicketDispenser</groupId>
- <artifactId>TurnTicketDispenser</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <dependencies>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.9</version>
- <type>jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
-</project>
View
7 ...ketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/ITurnNumberSequence.java
@@ -1,7 +0,0 @@
-package tddmicroexercises.turnticketdispenser;
-
-public interface ITurnNumberSequence {
-
- public int getNextTurnNumber();
-
-}
View
22 ...nTicketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/TicketDispenser.java
@@ -1,22 +0,0 @@
-package tddmicroexercises.turnticketdispenser;
-
-public class TicketDispenser
-{
- private ITurnNumberSequence turnNumberSequence;
-
- public TicketDispenser(){
- this(TurnNumberSequence.turnNumberSequence);
- }
-
- public TicketDispenser(ITurnNumberSequence turnNumberSequence) {
- this.turnNumberSequence = turnNumberSequence;
- }
-
- public TurnTicket getTurnTicket()
- {
- int newTurnNumber = turnNumberSequence.getNextTurnNumber();
- TurnTicket newTurnTicket = new TurnTicket(newTurnNumber);
-
- return newTurnTicket;
- }
-}
View
13 ...cketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/TurnNumberSequence.java
@@ -1,13 +0,0 @@
-package tddmicroexercises.turnticketdispenser;
-
-public class TurnNumberSequence implements ITurnNumberSequence
-{
- public static ITurnNumberSequence turnNumberSequence = new TurnNumberSequence();
-
- private int _turnNumber = 0;
-
- public int getNextTurnNumber()
- {
- return _turnNumber++;
- }
-}
View
17 ...a/TurnTicketDispenser/src/main/java/tddmicroexercises/turnticketdispenser/TurnTicket.java
@@ -1,17 +0,0 @@
-package tddmicroexercises.turnticketdispenser;
-
-public class TurnTicket
-{
- private final int turnNumber;
-
- public TurnTicket(int turnNumber)
- {
- this.turnNumber = turnNumber;
- }
-
- public int getTurnNumber()
- {
- return turnNumber;
- }
-
-}
View
11 ...Dispenser/src/test/java/tddmicroexercises/turnticketdispenser/MockTurnNumberSequence.java
@@ -1,11 +0,0 @@
-package tddmicroexercises.turnticketdispenser;
-
-public class MockTurnNumberSequence implements ITurnNumberSequence {
-
- private int turnNumber = 0;
-
- public int getNextTurnNumber() {
- return turnNumber++;
- }
-
-}
View
18 ...rc/test/java/tddmicroexercises/turnticketdispenser/TurnTicketDispenserCoveringsTests.java
@@ -1,18 +0,0 @@
-package tddmicroexercises.turnticketdispenser;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-
-public class TurnTicketDispenserCoveringsTests {
-
- @Test
- // Regression test to ensure existing API is not broken
- public void returnsAnIncrementingSequenceOfTicketsUsingDefaultSequenceImplementation() {
- TicketDispenser dispenser = new TicketDispenser();
- assertEquals(0,dispenser.getTurnTicket().getTurnNumber());
- assertEquals(1,dispenser.getTurnTicket().getTurnNumber());
- assertEquals(2,dispenser.getTurnTicket().getTurnNumber());
- }
-}
View
25 ...spenser/src/test/java/tddmicroexercises/turnticketdispenser/TurnTicketDispenserTests.java
@@ -1,25 +0,0 @@
-package tddmicroexercises.turnticketdispenser;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-
-public class TurnTicketDispenserTests {
-
- @Test
- public void returnsAnIncrementingSequenceOfTickets() {
- TicketDispenser dispenser = new TicketDispenser(new MockTurnNumberSequence());
- assertEquals(0,dispenser.getTurnTicket().getTurnNumber());
- assertEquals(1,dispenser.getTurnTicket().getTurnNumber());
- assertEquals(2,dispenser.getTurnTicket().getTurnNumber());
- }
-
- @Test
- public void sequenceIsMaintainedAcrossMultipleDispensers(){
- ITurnNumberSequence mockTurnNumberSequence = new MockTurnNumberSequence();
- assertEquals(0,new TicketDispenser(mockTurnNumberSequence).getTurnTicket().getTurnNumber());
- assertEquals(1,new TicketDispenser(mockTurnNumberSequence).getTurnTicket().getTurnNumber());
- assertEquals(2,new TicketDispenser(mockTurnNumberSequence).getTurnTicket().getTurnNumber());
- }
-}
View
188 TDDMicroExercises.ProposedSolution/Javascript/lib/jasmine-html.js
@@ -1,188 +0,0 @@
-jasmine.TrivialReporter = function(doc) {
- this.document = doc || document;
- this.suiteDivs = {};
- this.logRunningSpecs = false;
-};
-
-jasmine.TrivialReporter.prototype.createDom = function(type, attrs, childrenVarArgs) {
- var el = document.createElement(type);
-
- for (var i = 2; i < arguments.length; i++) {
- var child = arguments[i];
-
- if (typeof child === 'string') {
- el.appendChild(document.createTextNode(child));
- } else {
- if (child) { el.appendChild(child); }
- }
- }
-
- for (var attr in attrs) {
- if (attr == "className") {
- el[attr] = attrs[attr];
- } else {
- el.setAttribute(attr, attrs[attr]);
- }
- }
-
- return el;
-};
-
-jasmine.TrivialReporter.prototype.reportRunnerStarting = function(runner) {
- var showPassed, showSkipped;
-
- this.outerDiv = this.createDom('div', { className: 'jasmine_reporter' },
- this.createDom('div', { className: 'banner' },
- this.createDom('div', { className: 'logo' },
- this.createDom('a', { href: 'http://pivotal.github.com/jasmine/', target: "_blank" }, "Jasmine"),
- this.createDom('span', { className: 'version' }, runner.env.versionString())),
- this.createDom('div', { className: 'options' },
- "Show ",
- showPassed = this.createDom('input', { id: "__jasmine_TrivialReporter_showPassed__", type: 'checkbox' }),
- this.createDom('label', { "for": "__jasmine_TrivialReporter_showPassed__" }, " passed "),
- showSkipped = this.createDom('input', { id: "__jasmine_TrivialReporter_showSkipped__", type: 'checkbox' }),
- this.createDom('label', { "for": "__jasmine_TrivialReporter_showSkipped__" }, " skipped")
- )
- ),
-
- this.runnerDiv = this.createDom('div', { className: 'runner running' },