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

Increase test coverage #161

Merged
merged 1 commit into from
Mar 10, 2019
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 @@ -58,11 +58,6 @@ private void GivenTheProjectAlreadyHasAToggleState()
DataFixture.Create<string>());
}

private void GivenTheProjectionStreamVersionIsTheSameAsTheNextEvent()
{
StreamPosition = OriginalProjection.Audit.StreamPosition;
}

private async Task WhenWeHandleAnEnvironmentStateAddedEvent()
{
Event = new EnvironmentStateAdded(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace Evelyn.Core.Tests.ReadModel.Projections.ToggleState.ProjectEvents
using NSubstitute;
using TestStack.BDDfy;
using Xunit;
using Projections = Evelyn.Core.ReadModel.Projections;

public class EnvironmentStateDeletedSpecs : ProjectionBuilderHarness<EnvironmentStateDeleted>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace Evelyn.Core.Tests.ReadModel.Projections.ToggleState.ProjectEvents
using FluentAssertions;
using TestStack.BDDfy;
using Xunit;
using Projections = Evelyn.Core.ReadModel.Projections;

public class ToggleStateAddedSpecs : ProjectionBuilderHarness<ToggleStateAdded>
{
Expand All @@ -21,6 +20,16 @@ public void ProjectionDoesNotExist()
.BDDfy();
}

[Fact]
public void ProjectionAlreadyBuilt()
{
this.Given(_ => GivenTheProjectionExists())
.And(_ => GivenTheProjectionStreamVersionIsTheSameAsTheNextEvent())
.When(_ => WhenWeHandleAToggleStateAddedEvent())
.Then(_ => ThenTheStoredProjectionIsUnchanged())
.BDDfy();
}

[Fact]
public void Nominal()
{
Expand All @@ -37,14 +46,6 @@ protected override async Task HandleEventImplementation()
await ProjectionBuilder.Handle(StreamPosition, Event, StoppingToken);
}

private void GivenTheProjectionHasStateForAnotherEnvironment()
{
OriginalProjection.ToggleState.AddEnvironmentState(
DataFixture.Create<Projections.EventAudit>(),
DataFixture.Create<string>(),
DataFixture.Create<string>());
}

private async Task WhenWeHandleAToggleStateAddedEvent()
{
Event = DataFixture.Build<ToggleStateAdded>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ public void ProjectionDoesNotExist()
.BDDfy();
}

[Fact]
public void ProjectionAlreadyBuilt()
{
this.Given(_ => GivenTheProjectionExists())
.And(_ => GivenTheProjectionStreamVersionIsTheSameAsTheNextEvent())
.When(_ => WhenWeHandleAToggleStateChangedEvent())
.Then(_ => ThenTheStoredProjectionIsUnchanged())
.BDDfy();
}

[Fact]
public void Nominal()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ public void ProjectionDoesNotExist()
.BDDfy();
}

[Fact]
public void ProjectionAlreadyBuilt()
{
this.Given(_ => GivenTheProjectionExists())
.And(_ => GivenTheProjectionStreamVersionIsTheSameAsTheNextEvent())
.When(_ => WhenWeHandleAToggleStateDeletedEvent())
.Then(_ => ThenTheStoredProjectionIsUnchanged())
.BDDfy();
}

[Fact]
public void MultipleToggleStatesExist()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,10 @@ protected void GivenTheProjectionHasStateForOurEnvironment()
EnvironmentKey,
DataFixture.Create<string>());
}

protected void GivenTheProjectionStreamVersionIsTheSameAsTheNextEvent()
{
StreamPosition = OriginalProjection.Audit.StreamPosition;
}
}
}