Skip to content

Commit

Permalink
ManualFrameProvider -> FakeFrameProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
neuecc committed Jan 8, 2024
1 parent 983360c commit 4d3cff8
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/R3/FrameProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ public interface IFrameRunnerWorkItem
bool MoveNext(long frameCount);
}

public sealed class ManualFrameProvider : FrameProvider
public sealed class FakeFrameProvider : FrameProvider
{
long frameCount;
readonly object gate = new object();
FreeListCore<IFrameRunnerWorkItem> list;

public ManualFrameProvider()
public FakeFrameProvider()
{
list = new FreeListCore<IFrameRunnerWorkItem>(gate);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/R3.Tests/FactoryTests/EveryUpdateTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class EveryUpdateTest
public void EveryUpdateCancelImmediate()
{
var cts = new CancellationTokenSource();
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var list = Observable.EveryUpdate(frameProvider, cts.Token).Select(_ => frameProvider.GetFrameCount()).ToLiveList();

Expand All @@ -29,7 +29,7 @@ public void EveryUpdateCancelImmediate()
[Fact]
public void EveryUpdateDispose()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var list = Observable.EveryUpdate(frameProvider).Select(_ => frameProvider.GetFrameCount()).ToLiveList();

Expand Down
2 changes: 1 addition & 1 deletion tests/R3.Tests/FactoryTests/EveryValueChangedTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class EveryValueChangedTest
[Fact]
public void EveryValueChanged()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var t = new Target();
t.MyProperty = 99;
Expand Down
12 changes: 6 additions & 6 deletions tests/R3.Tests/FactoryTests/ReturnFrameTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class ReturnFrameTest
[Fact]
public void UnitTest()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();
var cts = new CancellationTokenSource();

var list = Observable.YieldFrame(frameProvider, cts.Token).ToLiveList();
Expand All @@ -22,7 +22,7 @@ public void UnitTest()
public void ValueTest()
{
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();
var cts = new CancellationTokenSource();

var list = Observable.ReturnFrame(10, frameProvider, cts.Token).ToLiveList();
Expand All @@ -33,7 +33,7 @@ public void ValueTest()
list.AssertEqual([10]);
}
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();
var cts = new CancellationTokenSource();

var list = Observable.ReturnFrame(10, frameProvider, cts.Token).ToLiveList();
Expand All @@ -47,7 +47,7 @@ public void ValueTest()
[Fact]
public void TimeTest()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();
var cts = new CancellationTokenSource();

var list = Observable.ReturnFrame(10, 5, frameProvider, cts.Token).ToLiveList();
Expand All @@ -65,7 +65,7 @@ public void TimeTest()
public void NextFrameTest()
{
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();
var cts = new CancellationTokenSource();

var list = Observable.NextFrame(frameProvider, cts.Token).ToLiveList();
Expand All @@ -79,7 +79,7 @@ public void NextFrameTest()
list.AssertEqual(Unit.Default);
}
{
var frameProvider = new ManualFrameProvider(); // use custom fake
var frameProvider = new FakeFrameProvider(); // use custom fake
var cts = new CancellationTokenSource();

var list = Observable.YieldFrame(frameProvider, cts.Token).ToLiveList();
Expand Down
12 changes: 6 additions & 6 deletions tests/R3.Tests/FactoryTests/TimerFrameTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ public class TimerFrameTest
public void TimerSingle()
{
{
var fakeTime = new ManualFrameProvider();
var fakeTime = new FakeFrameProvider();
var list = Observable.TimerFrame(0, fakeTime).ToLiveList();
fakeTime.Advance(1);
list.AssertIsCompleted();
list.AssertEqual([Unit.Default]);
}
{
var fakeTime = new ManualFrameProvider();
var fakeTime = new FakeFrameProvider();
var list = Observable.TimerFrame(1, fakeTime).ToLiveList();
fakeTime.Advance(1);
list.AssertIsCompleted();
list.AssertEqual([Unit.Default]);
}
{
var fakeTime = new ManualFrameProvider();
var fakeTime = new FakeFrameProvider();
var list = Observable.TimerFrame(2, fakeTime).ToLiveList();
fakeTime.Advance(2);
list.AssertIsCompleted();
Expand All @@ -32,7 +32,7 @@ public void TimerSingle()
[Fact]
public void TimerSingle2()
{
var fakeTime = new ManualFrameProvider();
var fakeTime = new FakeFrameProvider();

var list = Observable.TimerFrame(5, fakeTime).ToLiveList();

Expand All @@ -48,7 +48,7 @@ public void TimerSingle2()
public void TimerMulti()
{
var cts = new CancellationTokenSource();
var fakeTime = new ManualFrameProvider();
var fakeTime = new FakeFrameProvider();

var list = Observable.TimerFrame(5, 8, fakeTime, cts.Token).ToLiveList();

Expand Down Expand Up @@ -76,7 +76,7 @@ public void TimerMulti()
public void Interval()
{
var cts = new CancellationTokenSource();
var fakeTime = new ManualFrameProvider();
var fakeTime = new FakeFrameProvider();

var list = Observable.IntervalFrame(5, fakeTime, cts.Token).ToLiveList();

Expand Down
4 changes: 2 additions & 2 deletions tests/R3.Tests/OperatorTests/ChunkTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void ChunkWindowBoundary()
[Fact]
public void ChunkFrame()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var publisher = new Subject<int>();
var list = publisher.ChunkFrame(3, frameProvider).ToLiveList();
Expand Down Expand Up @@ -208,7 +208,7 @@ public void ChunkFrame()
[Fact]
public void ChunkFrameAndCount()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var publisher = new Subject<int>();
var list = publisher.ChunkFrame(3, 2, frameProvider).ToLiveList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public void Sample()
[Fact]
public void DebounceFrame()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var publisher = new Subject<int>();
var list = publisher.DebounceFrame(3, frameProvider).ToLiveList();
Expand Down Expand Up @@ -170,7 +170,7 @@ public void DebounceFrame()
[Fact]
public void ThrottleFirstFrame()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var publisher = new Subject<int>();
var list = publisher.ThrottleFirstFrame(3, frameProvider).ToLiveList();
Expand Down Expand Up @@ -205,7 +205,7 @@ public void ThrottleFirstFrame()
[Fact]
public void SampleFrame()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var publisher = new Subject<int>();
var list = publisher.ThrottleLastFrame(3, frameProvider).ToLiveList();
Expand Down
2 changes: 1 addition & 1 deletion tests/R3.Tests/OperatorTests/DelaySubscriptionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void DelaySubscription()
[Fact]
public void DelaySubscriptionFrame()
{
var provider = new ManualFrameProvider();
var provider = new FakeFrameProvider();

var publisher = new Subject<int>();
var subscribed = false;
Expand Down
2 changes: 1 addition & 1 deletion tests/R3.Tests/OperatorTests/DelayTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void Delay()
[Fact]
public void DelayFrame()
{
var provider = new ManualFrameProvider();
var provider = new FakeFrameProvider();
var subject = new Subject<int>();

var e = new List<Exception>();
Expand Down
4 changes: 2 additions & 2 deletions tests/R3.Tests/OperatorTests/ObserveOnTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void TimeProvider()
[Fact]
public void FrameProvider()
{
var fakeTime = new ManualFrameProvider();
var fakeTime = new FakeFrameProvider();
var publisher = new Subject<int>();

using var list = publisher.ObserveOn(fakeTime).ToLiveList();
Expand All @@ -77,7 +77,7 @@ public void FrameProvider()
public void FrameProvider2()
{

var fakeTime = new ManualFrameProvider();
var fakeTime = new FakeFrameProvider();
var publisher = new Subject<int>();

using var list = publisher.ObserveOn(fakeTime)
Expand Down
2 changes: 1 addition & 1 deletion tests/R3.Tests/OperatorTests/SkipLastTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void SkipTime()
[Fact]
public void SkipFrame2()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();
var cts = new CancellationTokenSource();

var list = Observable.EveryUpdate(frameProvider, cts.Token)
Expand Down
2 changes: 1 addition & 1 deletion tests/R3.Tests/OperatorTests/SkipTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void SkipTime()
[Fact]
public void SkipFrame()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var publisher = new Subject<int>();
var list = publisher.SkipFrame(3, frameProvider).ToLiveList();
Expand Down
2 changes: 1 addition & 1 deletion tests/R3.Tests/OperatorTests/SubscribeOnTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void TimeProvider()
public void FrameProvider()
{

var fakeTime = new ManualFrameProvider();
var fakeTime = new FakeFrameProvider();
var subscribed = false;
using var list = Observable.Range(1, 10)
.Do(onSubscribe: () => subscribed = true)
Expand Down
2 changes: 1 addition & 1 deletion tests/R3.Tests/OperatorTests/TakeLastTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public void TakeTime()
[Fact]
public void TakeFrame2()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();
var cts = new CancellationTokenSource();

var list = Observable.EveryUpdate(frameProvider, cts.Token)
Expand Down
4 changes: 2 additions & 2 deletions tests/R3.Tests/OperatorTests/TakeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public async Task Take()
[Fact]
public void TakeFrame()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var publisher = new Subject<int>();
var list = publisher.TakeFrame(5, frameProvider).ToLiveList();
Expand All @@ -54,7 +54,7 @@ public void TakeFrame()
[Fact]
public void TakeFrame2()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var list = Observable.EveryUpdate(frameProvider)
.Select(x => frameProvider.GetFrameCount())
Expand Down
2 changes: 1 addition & 1 deletion tests/R3.Tests/OperatorTests/TimeoutTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public void Timeout()
[Fact]
public void TimeoutFrame()
{
var frameProvider = new ManualFrameProvider();
var frameProvider = new FakeFrameProvider();

var publisher = new Subject<int>();
var list = publisher.TimeoutFrame(3, frameProvider).ToLiveList();
Expand Down
2 changes: 1 addition & 1 deletion tests/R3.Tests/ReplayFrameSubjectTest .cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class ReplayFrameSubjectTest
[Fact]
public void ReplayTime()
{
var fakeTime = new ManualFrameProvider();
var fakeTime = new FakeFrameProvider();

var subject = new ReplayFrameSubject<int>((3), fakeTime);

Expand Down

0 comments on commit 4d3cff8

Please sign in to comment.