Skip to content

Commit

Permalink
Merge branch 'release-6.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
mynkow committed Sep 30, 2020
2 parents a0c5259 + 517e4ea commit d790f7d
Show file tree
Hide file tree
Showing 51 changed files with 942 additions and 342 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public class TestJobData { }

public class TestJob : CronusJob<TestJobData>
{
public override string Name => "Test";
public override string Name { get; set; } = "Test";

protected override TestJobData BuildInitialData()
{
Expand Down
3 changes: 3 additions & 0 deletions src/Elders.Cronus.Tests/Projections/TestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,7 @@ public class TestEvent2 : IEvent { }

[DataContract(Name = "7898a318-c8e5-4be5-b1e3-13c4f5da28d5")]
public class TestEvent3 : IEvent { }

[DataContract(Name = "NonVersionableProjection")]
public class NonVersionableProjection : IProjection, INonVersionableProjection { }
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Machine.Specifications;
using Elders.Cronus.Projections.Versioning;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
Expand All @@ -9,17 +10,15 @@ public class When_adding_a_building_verrsion
{
version = new ProjectionVersion("projectionName", ProjectionStatus.Building, 1, "hash");
nextVersion = new ProjectionVersion("projectionName", ProjectionStatus.Building, 2, "hash");
versions = new ProjectionVersions();
};

Because of = () => versions.Add(version);
Because of = () => versions = new ProjectionVersions(version);

It should_have_next_version = () => versions.GetNext().ShouldEqual(nextVersion);
It should_have_next_version = () => versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy()).ShouldEqual(nextVersion);
It should_not_have_live_version = () => versions.GetLive().ShouldBeNull();

It should_not_be__canceled__ = () => versions.IsCanceled(version).ShouldBeFalse();
It should_not_be__outdated__ = () => versions.IsOutdatad(version).ShouldBeFalse();
It should_be__not_present__ = () => versions.IsNotPresent().ShouldBeFalse();

static ProjectionVersion version;
static ProjectionVersion nextVersion;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Machine.Specifications;
using Elders.Cronus.Projections.Versioning;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
Expand All @@ -8,20 +9,18 @@ public class When_adding_a_building_version_to_a_live_collection
Establish context = () =>
{
initialLiveVersion = new ProjectionVersion("projectionName", ProjectionStatus.Live, 1, "hash");
versions = new ProjectionVersions();
versions.Add(initialLiveVersion);
versions = new ProjectionVersions(initialLiveVersion);
version = new ProjectionVersion("projectionName", ProjectionStatus.Building, 2, "hash");
};

Because of = () => versions.Add(version);

It should_have_next_version = () => versions.GetNext().ShouldNotEqual(version);
It should_have_next_version = () => versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy()).ShouldNotEqual(version);
It should_have_live_version = () => versions.GetLive().ShouldNotBeNull();
It should_have_correct_live_version = () => versions.GetLive().ShouldEqual(initialLiveVersion);

It should_not_be__canceled__ = () => versions.IsCanceled(version).ShouldBeFalse();
It should_not_be__outdated__ = () => versions.IsOutdatad(version).ShouldBeFalse();
It should_be__not_present__ = () => versions.IsNotPresent().ShouldBeFalse();

static ProjectionVersion initialLiveVersion;
static ProjectionVersion version;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Elders.Cronus.Projections.Versioning;
using Elders.Cronus.Tests.Projections;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
[Subject("ProjectionVersions")]
public class When_adding_a_building_version_to_non_versionable_projection
{
Establish context = () =>
{
MessageInfo.GetContractId(typeof(NonVersionableProjection));
version = new ProjectionVersion("NonVersionableProjection", ProjectionStatus.Live, 1, "hash");
versions = new ProjectionVersions(version);
var rebuildVersion = versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy());
versions.Add(rebuildVersion);
nextVersion = new ProjectionVersion("NonVersionableProjection", ProjectionStatus.Live, 1, "hash");
};

Because of = () => versions.Add(nextVersion);

It should_not_have_live_version = () => versions.GetLive().ShouldEqual(version);

It should_not_be__canceled__ = () => versions.IsCanceled(version).ShouldBeFalse();
It should_not_be__outdated__ = () => versions.IsOutdatad(version).ShouldBeFalse();

static ProjectionVersion version;
static ProjectionVersion nextVersion;
static ProjectionVersions versions;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Machine.Specifications;
using Elders.Cronus.Projections.Versioning;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
Expand All @@ -9,17 +10,15 @@ public class When_adding_a_canceled_version
{
version = new ProjectionVersion("projectionName", ProjectionStatus.Canceled, 1, "hash");
nextVersion = new ProjectionVersion("projectionName", ProjectionStatus.Building, 2, "hash");
versions = new ProjectionVersions();
};

Because of = () => versions.Add(version);
Because of = () => versions = new ProjectionVersions(version);

It should_have_next_version = () => versions.GetNext().ShouldEqual(nextVersion);
It should_have_next_version = () => versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy()).ShouldEqual(nextVersion);
It should_not_have_live_version = () => versions.GetLive().ShouldBeNull();

It should_not_be__canceled__ = () => versions.IsCanceled(version).ShouldBeTrue();
It should_not_be__outdated__ = () => versions.IsOutdatad(version).ShouldBeFalse();
It should_be__not_present__ = () => versions.IsNotPresent().ShouldBeFalse();

static ProjectionVersion version;
static ProjectionVersion nextVersion;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Machine.Specifications;
using Elders.Cronus.Projections.Versioning;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
Expand All @@ -9,18 +10,16 @@ public class When_adding_a_live_version
{
version = new ProjectionVersion("projectionName", ProjectionStatus.Live, 1, "hash");
nextVersion = new ProjectionVersion("projectionName", ProjectionStatus.Building, 2, "hash");
versions = new ProjectionVersions();
};

Because of = () => versions.Add(version);
Because of = () => versions = new ProjectionVersions(version);

It should_have_next_version = () => versions.GetNext().ShouldEqual(nextVersion);
It should_have_next_version = () => versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy()).ShouldEqual(nextVersion);
It should_have_correct_live_version = () => versions.GetLive().ShouldEqual(version);
It should_have_live_version = () => versions.GetLive().ShouldNotBeNull();

It should_not_be__canceled__ = () => versions.IsCanceled(version).ShouldBeFalse();
It should_not_be__outdated__ = () => versions.IsOutdatad(version).ShouldBeFalse();
It should_be__not_present__ = () => versions.IsNotPresent().ShouldBeFalse();

static ProjectionVersion version;
static ProjectionVersion nextVersion;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Machine.Specifications;
using Elders.Cronus.Projections.Versioning;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
Expand All @@ -7,16 +8,15 @@ public class When_adding_a_live_version_to_a_versions_collection
{
Establish context = () =>
{
versions = new ProjectionVersions();
var notPresentVersion = new ProjectionVersion("projectionName", ProjectionStatus.NotPresent, 1, "hash");
var buldingVersion = new ProjectionVersion("projectionName", ProjectionStatus.Building, 1, "hash");
var canceledVersion = new ProjectionVersion("projectionName", ProjectionStatus.Canceled, 1, "hash");
var canceledVersion2 = new ProjectionVersion("projectionName", ProjectionStatus.Canceled, 1, "hash");
var timedoutVersion = new ProjectionVersion("projectionName", ProjectionStatus.Timedout, 1, "hash");
liveVersion = new ProjectionVersion("projectionName", ProjectionStatus.Live, 1, "hash");
versions.Add(notPresentVersion);
versions = new ProjectionVersions(notPresentVersion);
versions.Add(buldingVersion);
versions.Add(canceledVersion);
versions.Add(canceledVersion2);
Expand All @@ -27,13 +27,12 @@ public class When_adding_a_live_version_to_a_versions_collection

Because of = () => versions.Add(liveVersion);

It should_have_next_version = () => versions.GetNext().ShouldEqual(nextVersion);
It should_have_next_version = () => versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy()).ShouldEqual(nextVersion);
It should_have_live_version = () => versions.GetLive().ShouldNotBeNull();
It should_have_correct_live_version = () => versions.GetLive().ShouldEqual(liveVersion);

It should_not_be__canceled__ = () => versions.IsCanceled(liveVersion).ShouldBeFalse();
It should_not_be__outdated__ = () => versions.IsOutdatad(liveVersion).ShouldBeFalse();
It should_be__not_present__ = () => versions.IsNotPresent().ShouldBeFalse();

static ProjectionVersion liveVersion;
static ProjectionVersion nextVersion;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Machine.Specifications;
using Elders.Cronus.Projections.Versioning;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
Expand All @@ -8,24 +9,20 @@ public class When_adding_a_live_version_to_a_versions_collectionth
{
Establish context = () =>
{
versions = new ProjectionVersions();
var buildingVersion = new ProjectionVersion("projectionName", ProjectionStatus.Building, 1, "hash");
buildingVersion2 = new ProjectionVersion("projectionName", ProjectionStatus.Building, 2, "hash");
versions.Add(buildingVersion);
versions = new ProjectionVersions(buildingVersion);
buildingVersion2 = new ProjectionVersion("projectionName", ProjectionStatus.Building, 2, "hash");
nextVersion = new ProjectionVersion("projectionName", ProjectionStatus.Building, 3, "hash");
};

Because of = () => versions.Add(buildingVersion2);

It should_have_next_version = () => versions.GetNext().ShouldEqual(nextVersion);
It should_have_next_version = () => versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy()).ShouldEqual(nextVersion);
It should_have_live_version = () => versions.GetLive().ShouldBeNull();

It should_not_be__canceled__ = () => versions.IsCanceled(buildingVersion2).ShouldBeFalse();
It should_not_be__outdated__ = () => versions.IsOutdatad(buildingVersion2).ShouldBeFalse();
It should_be__not_present__ = () => versions.IsNotPresent().ShouldBeFalse();

static ProjectionVersion nextVersion;
static ProjectionVersions versions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Machine.Specifications;
using Elders.Cronus.Projections.Versioning;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
Expand All @@ -8,21 +9,20 @@ public class When_adding_a_live_version_twice
Establish context = () =>
{
var initialLiveVersion = new ProjectionVersion("projectionName", ProjectionStatus.Live, 1, "hash");
versions = new ProjectionVersions();
versions.Add(initialLiveVersion);
versions = new ProjectionVersions(initialLiveVersion);
version = new ProjectionVersion("projectionName", ProjectionStatus.Live, 2, "hash");
nextVersion = new ProjectionVersion("projectionName", ProjectionStatus.Building, 3, "hash");
};

Because of = () => versions.Add(version);

It should_have_next_version = () => versions.GetNext().ShouldEqual(nextVersion);
It should_have_next_version = () => versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy()).ShouldEqual(nextVersion);
It should_have_live_version = () => versions.GetLive().ShouldNotBeNull();
It should_have_correct_live_version = () => versions.GetLive().ShouldEqual(version);

It should_not_be__canceled__ = () => versions.IsCanceled(version).ShouldBeFalse();
It should_not_be__outdated__ = () => versions.IsOutdatad(version).ShouldBeFalse();
It should_be__not_present__ = () => versions.IsNotPresent().ShouldBeFalse();

static ProjectionVersion version;
static ProjectionVersion nextVersion;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Machine.Specifications;
using Elders.Cronus.Projections.Versioning;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
Expand All @@ -9,17 +10,15 @@ public class When_adding_a_pending_version
{
version = new ProjectionVersion("projectionName", ProjectionStatus.Pending, 1, "hash");
nextVersion = new ProjectionVersion("projectionName", ProjectionStatus.Building, 2, "hash");
versions = new ProjectionVersions();
};

Because of = () => versions.Add(version);
Because of = () => versions = new ProjectionVersions(version);

It should_have_next_version = () => versions.GetNext().ShouldEqual(nextVersion);
It should_have_next_version = () => versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy()).ShouldEqual(nextVersion);
It should_not_have_live_version = () => versions.GetLive().ShouldBeNull();

It should_not_be__canceled__ = () => versions.IsCanceled(version).ShouldBeFalse();
It should_not_be__outdated__ = () => versions.IsOutdatad(version).ShouldBeFalse();
It should_not_be__present__ = () => versions.IsNotPresent().ShouldBeFalse();

static ProjectionVersion version;
static ProjectionVersion nextVersion;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Machine.Specifications;
using Elders.Cronus.Projections.Versioning;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
Expand All @@ -9,17 +10,15 @@ public class When_adding_a_timedout_version
{
version = new ProjectionVersion("projectionName", ProjectionStatus.Timedout, 1, "hash");
nextVersion = new ProjectionVersion("projectionName", ProjectionStatus.Building, 2, "hash");
versions = new ProjectionVersions();
};

Because of = () => versions.Add(version);
Because of = () => versions = new ProjectionVersions(version);

It should_have_next_version = () => versions.GetNext().ShouldEqual(nextVersion);
It should_have_next_version = () => versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy()).ShouldEqual(nextVersion);
It should_not_have_live_version = () => versions.GetLive().ShouldBeNull();

It should_not_be__canceled__ = () => versions.IsCanceled(version).ShouldBeFalse();
It should_not_be__outdated__ = () => versions.IsOutdatad(version).ShouldBeFalse();
It should_not_be__not_present__ = () => versions.IsNotPresent().ShouldBeFalse();

static ProjectionVersion version;
static ProjectionVersion nextVersion;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using Elders.Cronus.Projections.Versioning;
using Elders.Cronus.Tests.Projections;
using Machine.Specifications;

namespace Elders.Cronus.Projections
{
[Subject("ProjectionVersions")]
public class When_getting_next_version_for_non_versionable_projection
{
Establish context = () =>
{
MessageInfo.GetContractId(typeof(NonVersionableProjection));
version = new ProjectionVersion("NonVersionableProjection", ProjectionStatus.Building, 1, "hash");
nextVersion = new ProjectionVersion("NonVersionableProjection", ProjectionStatus.Building, 1, "hash");
};

Because of = () => versions = new ProjectionVersions(version);

It should_have_next_version = () => versions.GetNext(new MarkupInterfaceProjectionVersioningPolicy()).ShouldEqual(nextVersion);
It should_not_have_live_version = () => versions.GetLive().ShouldBeNull();

It should_not_be__canceled__ = () => versions.IsCanceled(version).ShouldBeFalse();
It should_not_be__outdated__ = () => versions.IsOutdatad(version).ShouldBeFalse();

static ProjectionVersion version;
static ProjectionVersion nextVersion;
static ProjectionVersions versions;
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using Machine.Specifications;
//using Machine.Specifications;

namespace Elders.Cronus.Projections
{
[Subject("ProjectionVersions")]
public class When_having_empty_projection_versions
{
Because of = () => versions = new ProjectionVersions();
//namespace Elders.Cronus.Projections
//{
// [Subject("ProjectionVersions")]
// public class When_having_empty_projection_versions
// {
// Because of = () => versions = new ProjectionVersions();

It should_not_have_next_version = () => versions.GetNext().ShouldBeNull();
It should_not_have_live_version = () => versions.GetLive().ShouldBeNull();
// It should_not_have_next_version = () => versions.GetNext().ShouldBeNull();
// It should_not_have_live_version = () => versions.GetLive().ShouldBeNull();

static ProjectionVersions versions;
}
}
// static ProjectionVersions versions;
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ public class When_modifying_versions_collection_while_itterating_through_it
{
var building = new ProjectionVersion("buildingId", ProjectionStatus.Building, 1, "buildingHash");
versions = new ProjectionVersions();
versions.Add(building);
versions = new ProjectionVersions(building);
another = new ProjectionVersion("buildingId", ProjectionStatus.Canceled, 1, "buildingHash");
};
Expand Down

0 comments on commit d790f7d

Please sign in to comment.