public void TestShouldReturnGetCalculationInfluenceException() { var employee = Stubs.ValidEmployee(); _employeeGatewayMock.List().Returns(new List <Employee>() { employee }); var calculationInfluenceGatewayMock = Substitute.For <CalculationInfluenceGateway>(); calculationInfluenceGatewayMock.GetCalculationInfluence(employee).Returns(x => { throw new Exception(); }); var useCase = new UseCase( _loggerGatewayMock, _employeeGatewayMock, calculationInfluenceGatewayMock ); Assert.Throws <GetCalculationInfluenceException>(() => useCase.Execute(Stubs.ValidRequest())); }
public void TestShoulReturnOneParticipation() { var employee = Stubs.ValidEmployee(); var request = Stubs.ValidRequest(); _employeeGatewayMock.List().Returns(new List <Employee>() { employee }); var useCase = new UseCase( _loggerGatewayMock, _employeeGatewayMock, _calculationInfluenceGateway ); var response = useCase.Execute(request); Assert.Equal(18282528, response.Distribution.TotalDistributed); Assert.Same(employee, response.Distribution.Participations[0].Employee); Assert.Equal(request.AvailableValue, response.Distribution.TotalAvailable); }
public void TestShouldReturnCalculationInfluenceAreaNotFoundException() { _employeeGatewayMock.List().Returns(new List <Employee>() { Stubs.EmployeeWithInvalidArea() }); var useCase = new UseCase( _loggerGatewayMock, _employeeGatewayMock, _calculationInfluenceGateway ); Assert.Throws <CalculationInfluenceAreaNotFoundException>(() => useCase.Execute(Stubs.ValidRequest())); }