public void Then_SuccessFull_ActionOnValAndSupplementedVal()
        {
            var carInit = Pipe.Init <Storage, Car>(_ => new Car())
                          .Then(c => c.SetMark(Car.HondaMark))
                          .Then(carAndStorage => CarExt.SetOnStorage(carAndStorage.Val, carAndStorage.SupplementVal));

            var pipelineResult = (Option <Storage, Car>)carInit(new Storage());

            Assert.IsInstanceOfType(pipelineResult.SupplementVal, typeof(Car));
            Assert.IsTrue(pipelineResult.SupplementVal.IsHonda());
        }
        public void Then_SuccessFull_FuncOnValueAndSupplementedStateStateExt()
        {
            var carInit = Pipe.Init <Car, Storage>(_ => new Storage())
                          .Then(c => c.SetMark(Car.HondaMark))
                          .Then(CarExt.Validate)
                          .Then(StorageAndCar => CarExt.AddCarToState(StorageAndCar.SupplementVal, StorageAndCar))
                          .Then(CarExt.DriveFast);

            var pipelineResult = (Option <Car, Storage>)carInit(new Car());

            Assert.IsTrue(pipelineResult.GetOptionType == OptionType.Some);
            Assert.IsInstanceOfType(pipelineResult.SupplementVal, typeof(Storage));
            Assert.IsInstanceOfType(pipelineResult.Val, typeof(Car));

            Assert.IsTrue(pipelineResult.SupplementVal.State.Count == 1);
            Assert.IsInstanceOfType(pipelineResult.SupplementVal.State.First(), typeof(Car));
            Assert.IsTrue(((Car)pipelineResult.SupplementVal.State.First()).Speed == Car.SpeedFast);
        }
        public void CheckValidation()
        {
            var carInit = Pipe.Init <Unit, CarWithIInvariant>(_ => new CarWithIInvariant())
                          .Then(c => c.Mark = "Honda")
                          .Iff(CarExt.IsHonda)
                          .Then(c => CarExt.DriveFast(c))
                          .Iff(CarExt.IsToyota)
                          .Then(c => CarExt.DriveSlow(c))
                          .EndIff()
                          .Then((CarWithIInvariant c) => c.SetError())
                          .Then(c => CarExt.Park(c));

            var pipelineResult = (Option <Unit, CarWithIInvariant>)carInit(new Unit());

            Assert.IsTrue(pipelineResult.GetOptionType == OptionType.Validation);
            Assert.IsInstanceOfType(pipelineResult.SupplementVal, typeof(CarWithIInvariant));
            Assert.IsTrue(pipelineResult.SupplementVal.Speed == Car.SpeedFast);
            Assert.IsFalse(pipelineResult.SupplementVal.Parked);
            Assert.IsTrue(pipelineResult.ValidationResult.ErrorMessage == CarWithIInvariant.InValidError);
        }