Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't start manual tracking if automatic tracking is enabled. #312

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ public Task OnBeginMatchAsync(object sender, EventArgs args)
}

[Subscribe(FlowControlEvent.MatchStarted)]
public Task OnMatchStarted(object sender, EventArgs args) => tracker.BeginMatchAsync();
public Task OnMatchStarted(object sender, EventArgs args)
{
if (settings.AutomaticTracking)
{
return Task.CompletedTask;
}

return tracker.BeginMatchAsync();
}

[Subscribe(FlowControlEvent.MatchEnded)]
public Task OnMatchEnded(object sender, EventArgs args) => tracker.EndMatchAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,24 @@ public async Task Begin_Match_Is_Tracked_Depending_On_Settings(bool automaticTra

_tracker.Verify(m => m.BeginMatchAsync(), timesCalled);
}

[Fact]
public async Task Manual_Match_Tracking_Is_Disabled_If_Automatic_Tracking_Is_Enabled()
{
_settings.Setup(m => m.AutomaticTracking).Returns(true);

await Controller.OnMatchStarted(null, null);

_tracker.Verify(m => m.BeginMatchAsync(), Times.Never);
}

[Fact]
public async Task Manual_Match_Tracking_Is_Triggered_If_Automatic_Tracking_Is_Disabled()
{
_settings.Setup(m => m.AutomaticTracking).Returns(false);

await Controller.OnMatchStarted(null, null);

_tracker.Verify(m => m.BeginMatchAsync(), Times.Once);
}
}
Loading