コード例 #1
0
 protected override Validation <string, ActionAxisInput> CreateService(ILoggerFactory loggerFactory)
 {
     return
         (from positiveAction in PositiveAction.TrimToOption()
          .ToValidation("Positive action was not specified.")
          from negativeAction in NegativeAction.TrimToOption()
          .ToValidation("Negative action was not specified.")
          select new ActionAxisInput(
              Name,
              positiveAction,
              negativeAction,
              this,
              this,
              Active,
              loggerFactory)
     {
         Sensitivity = Sensitivity,
         Curve = Optional(Curve),
         DeadZone = DeadZone,
         Interpolate = Interpolate,
         WindowSize = WindowSize,
         WindowShift = WindowShift,
         Polling = Polling
     });
 }
コード例 #2
0
        public void Positive()
        {
            PositiveAction(new { test = -1 })
            .Should().Throw <ArgumentOutOfRangeException>()
            .And.Exception.ParamNameShouldBe("test");
            PositiveAction(new { test = 0 })
            .Should().Throw <ArgumentOutOfRangeException>()
            .And.Exception.ParamNameShouldBe("test");
            PositiveAction(new { test = -1, test2 = -1.0 })
            .Should().Throw <ArgumentOutOfRangeException>()
            .And.Exception.ParamNameShouldBe("test");
            PositiveAction(new { test = 1, test2 = 0 })
            .Should().Throw <ArgumentOutOfRangeException>()
            .And.Exception.ParamNameShouldBe("test2");

            PositiveAction(new { test = 1 })();
            PositiveAction(new { test = 1, test2 = 2.0 })();
        }