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: kopa/TDDwithMockObjectsAndDesignPrinciples
compare: master
Checking mergeability… Don’t worry, you can still create the pull request.
  • 7 commits
  • 13 files changed
  • 0 commit comments
  • 1 contributor
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
13 README.md
@@ -1,11 +1,10 @@
# TDD with Mock Objects: Design Principles and Emerging Properties
-Here you can find:
+This is a fork of Luca Minudel's original repo. He was using it for a study of TDD and Design principles. I am using it as a repository for storing four exercises useful for people wishing to improve their skills with TDD and SOLID principles. Please look at my blog post ["SOLID principles and TDD"](http://emilybache.blogspot.fi/2012/09/solid-principles-and-tdd.html) for background reading.
-- 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)
+- If you just want to do the exercises, copy the starting code of the [TDD micro-exercises] (https://github.com/emilybache/TDDwithMockObjectsAndDesignPrinciples/tree/master/TDDMicroExercises) in C#, Java, Javascript and Python
+
+- When you've had a go yourself, you could look at [proposed solutions] (https://github.com/emilybache/TDDwithMockObjectsAndDesignPrinciples/tree/master/TDDMicroExercises.ProposedSolution) in C#, Java, Javascript. If you've done the exercises in Python, you might be interested in my blog post ["SOLID exercises in Python"](http://emilybache.blogspot.fi/2012/09/solid-exercises-in-python.html).
+
+- For background reading about Luca's study, see the [paper] (https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples/blob/master/Paper/mockobjects_emergingproperties.pdf?raw=true) and the [presentation] (https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples/blob/master/Slides/TDD-SOLID.pdf?raw=true) from Luca's own repo.
-The complete Java version of the TDD micro-exercises and of the proposed solution soon available, porting underway by [peterrhysthomas] (https://github.com/peterrhysthomas).
View
BIN  Slides/TDD-SOLID.pdf
Binary file not shown
View
10 TDDMicroExercises.YoursSolutions/README.md
@@ -1,10 +0,0 @@
-# TDD micro-exercises
-
-## Your solution
-
-1. Fork the repository
-1. Add a folder with your name here
-1. Pull your solution
-1. Be social, comment and discuss it
-
-
View
4 ...Java/TelemetrySystem/src/main/java/tddmicroexercises/telemetrysystem/TelemetryClient.java
@@ -63,7 +63,7 @@ public void send(String message)
return;
}
- // here should go the real Send operation
+ // here should go the real Send operation (not needed for this exercise)
}
public String receive()
@@ -72,7 +72,7 @@ public String receive()
if (diagnosticMessageResult == null || "".equals(diagnosticMessageResult))
{
- // simulate a received message
+ // simulate a received message (just for illustration - not needed for this exercise)
message = "";
int messageLength = connectionEventsSimulator.nextInt(50) + 60;
for(int i = messageLength; i >=0; --i)
View
2  ...eMonitoringSystem/src/main/java/tddmicroexercises/tirepressuremonitoringsystem/Alarm.java
@@ -8,7 +8,6 @@
Sensor sensor = new Sensor();
boolean alarmOn = false;
- private long alarmCount = 0;
public void check()
{
@@ -17,7 +16,6 @@ public void check()
if (psiPressureValue < LowPressureTreshold || HighPressureTreshold < psiPressureValue)
{
alarmOn = true;
- alarmCount += 1;
}
}
View
4 TDDMicroExercises/Javascript/telemetry-system/telemetry-client.js
@@ -63,7 +63,7 @@ TelemetryClient.prototype = {
return;
}
- // here should go the real Send operation
+ // here should go the real Send operation (not needed for this exercise)
},
receive: function () {
@@ -71,7 +71,7 @@ TelemetryClient.prototype = {
if (typeof (this._diagnosticMessageResult) === 'undefined' || this._diagnosticMessageResult === '') {
- // simulate a received message
+ // simulate a received message (just for illustration - not needed for this exercise)
message = '';
var messageLenght = this._connectionEventsSimulator(50, 110);
for(var i = messageLenght; i >=0; --i) {
View
2  TDDMicroExercises/Javascript/tire-pressure-monitoring-system/alarm.js
@@ -5,7 +5,6 @@ Alarm = function() {
this._highPressureTreshold = 21;
this._sensor = new Sensor();
this._alarmOn = false;
- this._alarmCount = 0;
};
Alarm.prototype = {
@@ -17,7 +16,6 @@ Alarm.prototype = {
if (psiPressureValue < this._lowPressureTreshold || this._highPressureTreshold < psiPressureValue)
{
this._alarmOn = true;
- this._alarmCount += 1;
}
},
View
4 TDDMicroExercises/README.md
@@ -21,8 +21,8 @@ The responsibility of the TelemetryDiagnosticControls class is to establish a co
The TicketDispenser class is designed to be used to manage a queuing system in a shop. There may be more than one ticket dispenser but the same ticket should not be issued to two different customers.
-## A possible solution
+## After you've had a go yourself
-Here you find one of the possible solutions for the exercise: [proposed solution.] (https://github.com/lucaminudel/TDDwithMockObjectsAndDesignPrinciples/tree/master/TDDMicroExercises.ProposedSolution)
+Here you find possible solutions for the exercises: [proposed solution.] (https://github.com/emilybache/TDDwithMockObjectsAndDesignPrinciples/tree/master/TDDMicroExercises.ProposedSolution)
Feel free to send your comments and questions.
View
39 TDDMicroExercises/python/TelemetrySystem/telemetry.py
@@ -5,30 +5,26 @@ class TelemetryClient(object):
def __init__(self):
self.online_status = False
- self.diagnostic_message_result = ""
-
- def get_online_status(self):
- return self.online_status
+ self._diagnostic_message_result = ""
def connect(self, telemetry_server_connection_string):
- if (telemetry_server_connection_string is None or telemetry_server_connection_string == ""):
+ if not telemetry_server_connection_string:
raise Exception()
# simulate the operation on a real modem
success = random.randint(0, 10) <= 8
-
self.online_status = success
def disconnect(self):
self.online_status = False
def send(self, message):
- if (message is None or message == ""):
+ if not message:
raise Exception()
- if (message == TelemetryClient.DIAGNOSTIC_MESSAGE):
+ if message == TelemetryClient.DIAGNOSTIC_MESSAGE:
# simulate a status report
- self.diagnostic_message_result = """\
+ self._diagnostic_message_result = """\
LAST TX rate................ 100 MBPS\r\n
HIGHEST TX rate............. 100 MBPS\r\n
LAST RX rate................ 100 MBPS\r\n
@@ -45,11 +41,11 @@ def send(self, message):
Remote Rtrn Count........... 00"""
return
- # here should go the real Send operation
+ # here should go the real Send operation (not needed for this exercise)
def receive(self):
- if (self.diagnostic_message_result is None or self.diagnostic_message_result == ""):
- # simulate a received message
+ if not self._diagnostic_message_result:
+ # simulate a received message (just for illustration - not needed for this exercise)
message = ""
messageLength = random.randint(0, 50) + 60
i = messageLength
@@ -57,8 +53,8 @@ def receive(self):
message += chr((random.randint(0, 40) + 86))
i -= 1
else:
- message = self.diagnostic_message_result
- self.diagnostic_message_result = ""
+ message = self._diagnostic_message_result
+ self._diagnostic_message_result = ""
return message
@@ -66,23 +62,22 @@ class TelemetryDiagnosticControls:
DiagnosticChannelConnectionString = "*111#"
def __init__(self):
- self.telemetry_client = TelemetryClient()
+ self._telemetry_client = TelemetryClient()
self.diagnostic_info = ""
def check_transmission(self):
self.diagnostic_info = ""
-
- self.telemetry_client.disconnect()
+ self._telemetry_client.disconnect()
retryLeft = 3
- while (self.telemetry_client.get_online_status() == False and retryLeft > 0):
- self.telemetry_client.connect(TelemetryDiagnosticControls.DiagnosticChannelConnectionString)
+ while ((not self._telemetry_client.online_status) and retryLeft > 0):
+ self._telemetry_client.connect(TelemetryDiagnosticControls.DiagnosticChannelConnectionString)
retryLeft -= 1
- if telemetry_client.get_online_status() == False:
+ if not self._telemetry_client.online_status:
raise Exception("Unable to connect.")
- self.telemetry_client.send(TelemetryClient.DIAGNOSTIC_MESSAGE)
- self.diagnostic_info = self.telemetry_client.receive()
+ self._telemetry_client.send(TelemetryClient.DIAGNOSTIC_MESSAGE)
+ self.diagnostic_info = self._telemetry_client.receive()
View
12 TDDMicroExercises/python/TirePressureMonitoringSystem/tire_pressure_monitoring.py
@@ -21,11 +21,13 @@ def __init__(self):
self._low_pressure_threshold = 17
self._high_pressure_threshold = 21
self._sensor = Sensor()
- self.is_alarm_on = False
- self._alarm_count = 0
-
+ self._is_alarm_on = False
+
def check(self):
psi_pressure_value = self._sensor.pop_next_pressure_psi_value()
if psi_pressure_value < self._low_pressure_threshold or self._high_pressure_threshold < psi_pressure_value:
- self.is_alarm_on = True
- self._alarm_count += 1
+ self._is_alarm_on = True
+
+ @property
+ def is_alarm_on(self):
+ return self._is_alarm_on

No commit comments for this range

Something went wrong with that request. Please try again.