An interactive console-based calculator built as part of The C# Academy curriculum. The goal is to practice C# console application development.
- Interactive TUI: Powered by
Terminal.Gui, the application renders a fully interactive, mouse-friendly interface directly in the terminal — tabs, styled buttons, and a dual-line display included. - Complex expression evaluation: Powered by
NCalc, supports operator precedence, parentheses, and localized operators (e.g.19×(38÷4)+2). Results are formatted to up to 8 decimal places. - Keyboard support: Full keyboard input — digits, operators,
Enterto evaluate,Backspaceto delete, andCto clear. - Graceful error handling: Invalid expressions and undefined results (e.g. division by zero) produce an
Errorstate without crashing. - Clean architecture: UI, engine, and evaluation logic are separated into distinct layers.
CalculatorEnginedepends onIBasicService, injected via constructor — making the core fully testable without touching the UI. - Unit tested: Core behaviour is covered by xUnit + FluentAssertions tests across both
BasicServiceandCalculatorEngine. - Planned — AI Voice Input: As part of the C# Academy's AI Challenge, future versions will integrate Azure Language Services to accept spoken calculations.
| Runtime | C# / .NET 10 |
| TUI framework | Terminal.Gui |
| Expression parser | NCalcSync |
| Testing | xUnit + FluentAssertions |
| Planned | Azure Cognitive Services (speech-to-text) |
# 1. Clone the repository
git clone https://github.com/your-username/ConsoleCalculator.git
cd ConsoleCalculator
# 2. Restore dependencies
dotnet restore
# 3. Run the application
dotnet run --project src/ConsoleCalculator
# 4. Run the test suite
dotnet test