public void Scale_from_same_is_idempotent()
    {
        var scaler = new FramerateScaler <string>(30, 30, _originalFrames);

        Assert.AreEqual(scaler.InputDuration, scaler.OutputDuration);
        Assert.AreEqual(_originalFrames.Count, scaler.Count());
        Assert.IsTrue(_originalFrames.SequenceEqual(scaler));
    }
    public void Scale_from_30_to_100()
    {
        var scaler = new FramerateScaler <string>(30, 100, _originalFrames);

        Assert.AreEqual(1000, scaler.Count());
        Assert.AreEqual(scaler.OutputDuration, scaler.InputDuration);
        // 000 - 111 - 2222 ...
        Assert.IsTrue(scaler.PatternIs(0, 0, 0, 1, 1, 1, 2, 2, 2, 2));
    }
    public void Scale_from_30_to_15()
    {
        var scaler = new FramerateScaler <string>(30, 15, _originalFrames);

        Assert.AreEqual(150, scaler.Count());
        Assert.AreEqual(scaler.OutputDuration, scaler.InputDuration);
        Assert.IsTrue(_originalFrames
                      .Where((item, index) => index % 2 == 1)
                      .SequenceEqual(scaler));
    }
    public void Scale_from_same_offset_by_half_is_idempotent()
    {
        var scaler = new FramerateScaler <string>(
            30, 30, _originalFrames, _originalFrames.Count / 2);

        Assert.AreEqual(150, scaler.Count());
        Assert.AreEqual(scaler.OutputDuration, scaler.InputDuration);
        Assert.IsTrue(_originalFrames
                      .Skip(150)
                      .SequenceEqual(scaler));
    }
    public void Scale_from_24p_to_ntsc()
    {
        var scaler = new FramerateScaler <string>(23.967, 29.97, _originalFrames);

        Assert.AreEqual(375, scaler.Count());
        Assert.AreEqual(
            scaler.OutputDuration.TotalMilliseconds,
            scaler.InputDuration.TotalMilliseconds, delta: 4);
        // 0 - 1 - 2 - 33 ...
        Assert.IsTrue(scaler.PatternIs(0, 1, 2, 3, 3));
    }
    public void Scale_from_30_to_60_offset_by_half()
    {
        var scaler = new FramerateScaler <string>(
            30, 60, _originalFrames, _originalFrames.Count / 2);

        Assert.AreEqual(300, scaler.Count());
        Assert.AreEqual(scaler.OutputDuration, scaler.InputDuration);
        Assert.IsTrue(_originalFrames
                      .Skip(150)
                      .Concat(_originalFrames.Skip(150))
                      .OrderBy(x => x)
                      .SequenceEqual(scaler));
    }
    public void Scale_from_30_to_60()
    {
        var scaler = new FramerateScaler <string>(30, 60, _originalFrames);

        Assert.AreEqual(600, scaler.Count());
        Assert.AreEqual(scaler.OutputDuration, scaler.InputDuration);
        var result = scaler.ToList();

        Assert.IsTrue(_originalFrames
                      .Concat(_originalFrames)
                      .OrderBy(x => x)
                      .SequenceEqual(scaler));
    }