public ActionResult Init()
    {
        var basicCommand = new CreateBasicElectricityTariffProductCommand();

        basicCommand.Name               = "Basic electricity tariff";
        basicCommand.CentkWh            = 22;
        basicCommand.BasicCostsPerMonth = 5;
        var result = _handler.Handle(basicCommand);

        if (_handler.Invalid)
        {
            return(BadRequest(result));
        }

        var packagedCommand = new CreatePackagedTariffProductCommand();

        packagedCommand.Name              = "Packaged tariff";
        packagedCommand.CentkWh           = 30;
        packagedCommand.BasicCostsPerYear = 800;
        packagedCommand.BasicConsumption  = 4000;
        result = _handler.Handle(packagedCommand);
        if (_handler.Invalid)
        {
            return(BadRequest(result));
        }

        return(Ok());
    }
        public void ShouldReturnErrorWhenIsInvalid()
        {
            // I'm not informing the consumption for the command, neither the repository for the handler.
            var command = new CreateComparisonCommand();
            var handler = new ComparisonHandler(null);
            var result  = handler.Handle(command);

            Assert.IsTrue(handler.Invalid);
        }
        public void ShouldReturnSuccessWhenIsValid()
        {
            // Valid comparison using the fake repository
            var command = new CreateComparisonCommand();

            command.Consumption = 3500;
            var handler = new ComparisonHandler(new FakeProductRepository());
            var result  = handler.Handle(command);

            Assert.IsTrue(handler.Valid);
        }