This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Percentage = Percentage of float | |
type ResidentDiscount = ResidentDiscount of Percentage | |
type FamilyDiscount = FamilyDiscount of Percentage | |
type SpecialResidentDiscount = SpecialResidentDiscount of Percentage | |
type BussinesClub = BussinesClub of Percentage | |
type SpanishSubsidy = | |
| SpecialResident of SpecialResidentDiscount | |
| Resident of ResidentDiscount | |
| Family of FamilyDiscount |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
class Rating {} | |
class SessionSequence { | |
private int sequenceNumber; | |
public SessionSequence(int sequenceNumber){ | |
this.sequenceNumber = sequenceNumber; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ProjectBillingService { | |
private final CustomerContract contract; | |
private final DeveloperHistoryRepository repository; | |
/*...*/ | |
public ProjectBillingService(DeveloperHistoryRepository repository, CustomerContract contract) { | |
this.repository = repository; | |
this.contract = contract; | |
} | |
/*...*/ | |
public BigDecimal calculateCost(YearMonth yearMonth){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.Test; | |
import java.util.Arrays; | |
import java.util.Objects; | |
import static org.assertj.core.api.Assertions.*; | |
public class BenchmarkTests { | |
static class Record implements Comparable<Record> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from camera import Controller, Sensor, Recorder | |
from doublex import Spy, Stub, assert_that, called | |
class CameraTestsUsingLibrary(unittest.TestCase): | |
def test_asks_the_recorder_to_stop_recording_when_no_information_received_from_sensor(self): | |
sensor = Stub(Sensor) | |
recorder = Spy(Recorder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from camera import Controller, Sensor, Recorder | |
class MockMovementSensor(Sensor): | |
def is_detecting_movement(self) -> bool: | |
return True | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from camera import Controller, Sensor, Recorder | |
class CameraTests(unittest.TestCase): | |
sensor: Sensor | |
recorder: Recorder | |
controller: Controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from camera import Controller, Sensor, Recorder | |
class CameraTests(unittest.TestCase): | |
def test_asks_the_recorder_to_stop_recording_when_no_information_received_from_sensor(self): | |
sensor = Sensor() # mocks | |
recorder = Recorder() # mocks | |
self.called = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Sensor: | |
"""Lo vamos a simular""" | |
def is_detecting_movement(self) -> bool: | |
pass | |
class Recorder: | |
"""Lo vamos a simular""" | |
def start_recording(self): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import unittest | |
from cards import who_wins | |
# ToDo List: | |
# diferente cantidad de cartas -> raise error | |
# ['1'],['3','4'] -> raise error | |
# cartas con invalidos, | |
# 'W' -> raise error |
NewerOlder