Last active
November 9, 2020 20:41
-
-
Save antklim/aea8de49010aa814948ad93df6ce8da7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
void main() { | |
group('Calculator use case', () { | |
group('calculates value of', () { | |
Map<CalculatorUseCase, num> testCases = { | |
CalculatorUseCase(operation: Operation.addition, operandA: 1, operandB: 2): 3, | |
... | |
}; | |
testCases.forEach((useCase, expected) { | |
test('${useCase.operation}', () { | |
expect(useCase.value, expected); | |
}); | |
}); | |
}); | |
group('formats', () { | |
Map<CalculatorUseCase, String> testCases = { | |
CalculatorUseCase(operation: Operation.addition, operandA: 1, operandB: 2): '1 + 2', | |
... | |
}; | |
testCases.forEach((useCase, expected) { | |
test('${useCase.operation}', () { | |
expect(useCase.format, expected); | |
}); | |
}); | |
}); | |
test('sets operation', () { | |
CalculatorUseCase useCase = CalculatorUseCase(operation: Operation.addition, operandA: 1, operandB: 2); | |
expect(useCase.operation, Operation.addition); | |
useCase.setOperation(Operation.subtraction); | |
expect(useCase.operation, Operation.subtraction); | |
}); | |
test('sets operands', () {...}); | |
test('sets operands from memory', () {...}); | |
test('manages memory', () {...}); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment