Beispiel #1
0
        public void GetCalculationResult_Should_Call_Calculation_Service()
        {
            // Arrange
            var sut = new CalculationActionHandlerSut();

            sut.ExpressionCalculator.Calculate(Arg.Any <string>()).ReturnsForAnyArgs(new Result <int>());

            // Act
            sut.GetCalculationResult("test");

            // Assert
            sut.ExpressionCalculator.Received().Calculate("test");
        }
Beispiel #2
0
        public void GetHistory_Should_Process_Query()
        {
            // Arrange
            var sut = new CalculationActionHandlerSut();

            sut.QueryProcessor.For <IEnumerable <CalculatorHistory> >().Process(Arg.Any <GetCalculatorHistoryContext>())
            .ReturnsForAnyArgs(new List <CalculatorHistory>());

            // Act
            sut.GetHistory();

            // Assert
            sut.QueryProcessor.Received().For <IEnumerable <CalculatorHistory> >().Process(Arg.Any <GetCalculatorHistoryContext>());
        }
Beispiel #3
0
        public void GetCalculationResult_Should_Save_The_Result()
        {
            // Arrange
            var sut = new CalculationActionHandlerSut();

            sut.ExpressionCalculator.Calculate(Arg.Any <string>()).ReturnsForAnyArgs(new Result <int>());
            sut.CommandProcessor.Process(Arg.Any <CreateCalculatorHistoryCommand>());

            // Act
            sut.GetCalculationResult("test");

            // Assert
            sut.CommandProcessor.Received().Process(Arg.Any <CreateCalculatorHistoryCommand>());
        }