public async Task CheckChangeWidth_ShouldCallRender()
        {
            _timeLineRenderMock.Setup(t => t.RenderDataAsync(It.IsAny <double>(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult((ImageSource) new BitmapImage()));;
            var vm = new EventDensityViewModel(_scalerMock.Object, _densityApiMock.Object, _loggerMock.Object, _timeLineRenderMock.Object, _chartRenderMock.Object);

            vm.ChangeWidth(100);
            await Task.Delay(300);

            _timeLineRenderMock.Verify(t => t.RenderDataAsync(It.IsAny <double>(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>()), Times.AtLeastOnce);
        }
        public async Task CheckChangeWidth_CheckThrottling()
        {
            _timeLineRenderMock.Setup(t => t.RenderDataAsync(It.IsAny <double>(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult((ImageSource) new BitmapImage()));;
            var vm = new EventDensityViewModel(_scalerMock.Object, _densityApiMock.Object, _loggerMock.Object, _timeLineRenderMock.Object, _chartRenderMock.Object);

            for (int i = 0; i < 10; i++)
            {
                vm.ChangeWidth(i * 15);
            }

            await Task.Delay(300);

            _timeLineRenderMock.Verify(t => t.RenderDataAsync(It.IsAny <double>(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>()), Times.AtMost(10));
        }
        public void CheckChangeScale()
        {
            _timeLineRenderMock.Setup(t => t.RenderDataAsync(It.IsAny <double>(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult((ImageSource) new BitmapImage()));
            _chartRenderMock.Setup(t => t.RenderDataAsync(It.IsAny <IEnumerable <DensityInfo> >(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult((ImageSource) new BitmapImage()));
            _scalerMock.Setup(t => t.Scale(It.IsAny <double>(), It.IsAny <bool>()));
            _densityApiMock.Setup(t => t.GetDensityInfoAsync(It.IsAny <long>(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>())).Returns(Task.FromResult(new List <DensityInfo>
            {
                new DensityInfo()
                {
                    EventsCount = 1, Start = 10, StartIndex = 0, Stop = 100, StopIndex = 1
                }
            }));

            var vm = new EventDensityViewModel(_scalerMock.Object, _densityApiMock.Object, _loggerMock.Object, _timeLineRenderMock.Object, _chartRenderMock.Object);

            vm.ChangeWidth(100);
            vm.ChangeScale(0.5, true);

            _timeLineRenderMock.Verify(t => t.RenderDataAsync(It.IsAny <double>(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>()), Times.AtLeastOnce);
            _chartRenderMock.Verify(t => t.RenderDataAsync(It.IsAny <IEnumerable <DensityInfo> >(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>()), Times.AtLeastOnce);
            _scalerMock.Verify(t => t.Scale(It.IsAny <double>(), It.IsAny <bool>()), Times.AtLeastOnce);
            _densityApiMock.Verify(t => t.GetDensityInfoAsync(It.IsAny <long>(), It.IsAny <long>(), It.IsAny <long>(), It.IsAny <CancellationToken>()), Times.AtLeastOnce);
        }