Beispiel #1
0
        public void Display_payslip_from_generator()
        {
            var payslip        = GetPayslipFake();
            var expectedOutput = GetContent("payslip-output.txt");

            _mockPayslipGenerator.Setup(x => x.Generate(It.IsAny <PayslipRequest>())).Returns(payslip);
            var payslipConsoleApp = new PayslipGeneratorConsole(_mockInputReader.Object, _mockOutputWriter.Object, _mockPayslipGenerator.Object);

            payslipConsoleApp.Run();

            _mockOutputWriter.Verify(x => x.Write(expectedOutput));
        }
Beispiel #2
0
        public void Get_user_input()
        {
            var payslip = GetPayslipFake();

            _mockPayslipGenerator.Setup(x => x.Generate(It.IsAny <PayslipRequest>())).Returns(payslip);
            var payslipConsoleApp = new PayslipGeneratorConsole(_mockInputReader.Object, _mockOutputWriter.Object, _mockPayslipGenerator.Object);

            payslipConsoleApp.Run();

            _mockOutputWriter.Verify(x => x.Write("Please enter your name: "));
            _mockOutputWriter.Verify(x => x.Write("Please enter your surname: "));
            _mockOutputWriter.Verify(x => x.Write("Please enter your payment start date: "));
            _mockOutputWriter.Verify(x => x.Write("Please enter your payment end date: "));
            _mockOutputWriter.Verify(x => x.Write("Please enter your annual salary: "));
            _mockOutputWriter.Verify(x => x.Write("Please enter your super rate: "));
            _mockInputReader.Verify(x => x.Read(), Times.Exactly(6));
        }