コード例 #1
0
        /// <summary>
        /// Add double model
        /// </summary>
        /// <param name="context"></param>
        /// <param name="key"></param>
        /// <param name="value"></param>
        /// <param name="renderPattern"></param>
        /// <returns></returns>
        public static ContextModel AddDouble(this ContextModel context, string key, double value, string renderPattern)
        {
            var element = new DoubleModel(value, renderPattern);

            context.AddItem(key, element);
            return(context);
        }
コード例 #2
0
        public DoubleModel AreaFloats(double min, double max)
        {
            var floatModel = new DoubleModel
            {
                TemperatureInput01 = RandomDouble(min, max),
                TemperatureInput02 = RandomDouble(min, max),
                TemperatureInput03 = RandomDouble(min, max),
                TemperatureInput04 = RandomDouble(min, max),
                TemperatureInput05 = RandomDouble(min, max),
                TemperatureInput06 = RandomDouble(min, max),
                TemperatureInput07 = RandomDouble(min, max),
                TemperatureInput08 = RandomDouble(min, max),
                TemperatureInput09 = RandomDouble(min, max),
                TemperatureInput10 = RandomDouble(min, max),
                TemperatureInput11 = RandomDouble(min, max),
                TemperatureInput12 = RandomDouble(min, max),
                TemperatureInput13 = RandomDouble(min, max),
                TemperatureInput14 = RandomDouble(min, max),
                TemperatureInput15 = RandomDouble(min, max),
                TemperatureInput16 = RandomDouble(min, max),
                TemperatureInput17 = RandomDouble(min, max),
                TemperatureInput18 = RandomDouble(min, max),
                TemperatureInput19 = RandomDouble(min, max),
                TemperatureInput20 = RandomDouble(min, max)
            };

            return(floatModel);
        }
コード例 #3
0
        /// <summary>
        /// 创建Double值之间的线性动画
        /// </summary>
        public static DoubleAnimation BuildDoubleAnimation(DoubleModel Model)
        {
            (Model.Target as UIElement).RenderTransform = TransitionHelper.GetTransformGroup(Model.Target);

            DoubleAnimation _doubleAnimation = new DoubleAnimation();

            _doubleAnimation.From           = Model.From;
            _doubleAnimation.To             = Model.To;
            _doubleAnimation.Duration       = new Duration(TimeSpan.FromSeconds(Model.Duration));
            _doubleAnimation.AutoReverse    = Model.AutoReverse;
            _doubleAnimation.BeginTime      = TimeSpan.FromSeconds(Model.BeginTime);
            _doubleAnimation.By             = Model.By;
            _doubleAnimation.FillBehavior   = Model.FillBehavior;
            _doubleAnimation.RepeatBehavior = Model.RepeatBehavior;
            _doubleAnimation.SpeedRatio     = Model.SpeedRatio;

            if (Model.EasingFunction != null)
            {
                _doubleAnimation.EasingFunction = Model.EasingFunction;
            }


            Storyboard.SetTarget(_doubleAnimation, Model.Target);
            Storyboard.SetTargetProperty(_doubleAnimation, new PropertyPath(Model.PropertyPath));
            return(_doubleAnimation);
        }
コード例 #4
0
        public void Extract_Double_ShouldMapFromFloat(double value)
        {
            // Arrange
            var          doubleValue = value;
            RfcErrorInfo errorInfo;

            _interopMock.Setup(x => x.GetFloat(DataHandle, "DOUBLEVALUE", out doubleValue, out errorInfo));

            // Act
            DoubleModel result = OutputMapper.Extract <DoubleModel>(_interopMock.Object, DataHandle);

            // Assert
            result.Should().NotBeNull();
            result.DoubleValue.Should().Be(doubleValue);
        }
コード例 #5
0
        public void Validate_TypeLeftInRightOut_RequireRightToHaveAValue(ValidationType type, string rightName)
        {
            //Arrange
            var left = new DoubleModel()
            {
                Name = null,
                Type = DoubleModelType.In
            };
            var right = new DoubleModel()
            {
                Name = rightName,
                Type = DoubleModelType.Out
            };

            //Act
            var result = _sut.ValidateSection(DoubleLeftRightValidator.InOutSection, left, right);

            //Assert
            result.Should(type, "670ac060-d954-4518-8d03-155130391b92");
        }
コード例 #6
0
        public void Validate_TypeLeftInRightOut_RequireLeftToBeNull(ValidationType type, string leftName)
        {
            //Arrange
            var left = new DoubleModel()
            {
                Name = leftName,
                Type = DoubleModelType.In
            };
            var right = new DoubleModel()
            {
                Name = null,
                Type = DoubleModelType.Out
            };

            //Act
            var result = _sut.ValidateSection(DoubleLeftRightValidator.InOutSection, left, right);

            //Assert
            result.Should(type, "66a73e51-1c21-4ef7-958c-ae45acfd9f45");
        }
コード例 #7
0
        public void Validate_TypeBothIn_RequiresSameName(ValidationType type, string leftName, string rightName)
        {
            //Arrange
            var left = new DoubleModel()
            {
                Name = leftName,
                Type = DoubleModelType.In
            };
            var right = new DoubleModel()
            {
                Name = rightName,
                Type = DoubleModelType.In
            };

            //Act
            var result = _sut.ValidateSection(DoubleLeftRightValidator.InInSection, left, right);

            //Assert
            result.Should(type, "e229be44-ec96-436a-916c-dbbfabe7a7f3");
        }
コード例 #8
0
        public void TestMathFunctions()
        {
            const double num   = 0.6;
            var          model = new DoubleModel
            {
                Number   = num,
                Document = new MutableDocument("doc1")
            };

            Db.Save(model);

            var expectedValues = new[] {
                Math.Abs(num), Math.Acos(num), Math.Asin(num), Math.Atan(num),
                Math.Ceiling(num), Math.Exp(num),
                Math.Floor(num), Math.Log(num), Math.Log10(num),
                Math.Round(num), Math.Sin(num), Math.Sqrt(num),
                Math.Tan(num), Math.Truncate(num)
            };

            int index     = 0;
            var queryable = new DatabaseQueryable <DoubleModel>(Db);
            var parameter = LinqExpression.Parameter(typeof(DoubleModel), "x");

            foreach (var function in new[] {
                "Abs", "Acos", "Asin", "Atan",
                "Ceiling", "Exp",
                "Floor", "Log", "Log10",
                "Round", "Sin", "Sqrt",
                "Tan", "Truncate"
            })
            {
                var methodCall = LinqExpression.Lambda <Func <DoubleModel, double> >(LinqExpression.Call(typeof(Math).GetMethod(function, new[] { typeof(double) }), LinqExpression.Property(parameter, "Number")), parameter);
                var q          = queryable.Select(methodCall);
                var numRows    = VerifyQuery(q, (n, r) =>
                {
                    r.Should().Be(expectedValues[index++]);
                });

                numRows.Should().Be(1);
            }
        }
コード例 #9
0
        public MainWindow()
        {
            InitializeComponent();

            var one = new DoubleModel(
                wpfPlot1,
                DataSource.ObserveValues(),
                Observable.Interval(TimeSpan.FromMilliseconds(150)).ObserveOnDispatcher().Select(a => Unit.Default));

            var two = new OHLCModel(
                wpfPlot2,
                DataSource.ObserveOHLCValues(),
                Observable.Interval(TimeSpan.FromMilliseconds(1000)).ObserveOnDispatcher().Select(a => Unit.Default));

            var three = new DoubleModel(wpfPlot3, DataSource.ObserveValues());

            PlotView1.Data = DataGen.RandomStockPrices(new Random(), 200, sequential: true);

            wpfPlot4.Children.Add(new WpfPlot(PlotFactory.CreateHistogramPlot()));

            wpfPlot5.Children.Add(new WpfPlot(PlotFactory.CreateAdvancedStatisticsPlot()));
        }
コード例 #10
0
ファイル: DoubleComponents.cs プロジェクト: JuRogn/OA
        /// <summary>
        /// 创建Double值之间的线性动画
        /// </summary>
        public static DoubleAnimation BuildDoubleAnimation(DoubleModel Model)
        {

            (Model.Target as UIElement).RenderTransform=TransitionHelper.GetTransformGroup(Model.Target);

            DoubleAnimation _doubleAnimation = new DoubleAnimation();
            _doubleAnimation.From = Model.From;
            _doubleAnimation.To = Model.To;
            _doubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(Model.Duration));
            _doubleAnimation.AutoReverse = Model.AutoReverse;
            _doubleAnimation.BeginTime = TimeSpan.FromSeconds(Model.BeginTime);
            _doubleAnimation.By = Model.By;
            _doubleAnimation.FillBehavior = Model.FillBehavior;
            _doubleAnimation.RepeatBehavior = Model.RepeatBehavior;
            _doubleAnimation.SpeedRatio = Model.SpeedRatio;

            if (Model.EasingFunction != null)
                _doubleAnimation.EasingFunction = Model.EasingFunction;


            Storyboard.SetTarget(_doubleAnimation, Model.Target);
            Storyboard.SetTargetProperty(_doubleAnimation, new PropertyPath(Model.PropertyPath));
            return _doubleAnimation;
        }
コード例 #11
0
 public void StringToDouble(DoubleModel sampleData)
 {
     Assert.Equal(sampleData.Expected, sampleData.Actual.ToDouble());
 }