Browse Source

Cleanup

pull/218/head
Sebastian Stehle 8 years ago
parent
commit
c6c0250a5b
  1. 1
      src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonConvention.cs
  2. 10
      src/Squidex.Infrastructure/Commands/DomainObjectBase.cs
  3. 1
      src/Squidex.Infrastructure/Json/NamedGuidIdConverter.cs
  4. 1
      src/Squidex.Infrastructure/Json/NamedLongIdConverter.cs
  5. 17
      tests/Squidex.Infrastructure.Tests/Commands/DomainObjectBaseTests.cs

1
src/Squidex.Infrastructure.MongoDb/MongoDb/BsonJsonConvention.cs

@ -12,7 +12,6 @@ using MongoDB.Bson.Serialization;
using MongoDB.Bson.Serialization.Conventions;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Squidex.Infrastructure.MongoDb;
namespace Squidex.Infrastructure.MongoDb
{

10
src/Squidex.Infrastructure/Commands/DomainObjectBase.cs

@ -7,7 +7,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading.Tasks;
using Squidex.Infrastructure.EventSourcing;
using Squidex.Infrastructure.States;
@ -53,9 +52,7 @@ namespace Squidex.Infrastructure.Commands
ApplyEvent(@event);
snapshot.Version++;
uncomittedEvents.Add(@event.To<IEvent>());
uncomittedEvents.Add(@event);
}
public IReadOnlyList<Envelope<IEvent>> GetUncomittedEvents()
@ -79,11 +76,6 @@ namespace Squidex.Infrastructure.Commands
public Task WriteSnapshotAsync()
{
if (persistence.Version == EtagVersion.NotFound)
{
Debugger.Break();
}
snapshot.Version = persistence.Version;
return persistence.WriteSnapshotAsync(snapshot);

1
src/Squidex.Infrastructure/Json/NamedGuidIdConverter.cs

@ -6,7 +6,6 @@
// ==========================================================================
using System;
using System.Linq;
using Newtonsoft.Json;
namespace Squidex.Infrastructure.Json

1
src/Squidex.Infrastructure/Json/NamedLongIdConverter.cs

@ -6,7 +6,6 @@
// ==========================================================================
using System;
using System.Linq;
using Newtonsoft.Json;
namespace Squidex.Infrastructure.Json

17
tests/Squidex.Infrastructure.Tests/Commands/DomainObjectBaseTests.cs

@ -36,23 +36,6 @@ namespace Squidex.Infrastructure.Commands
Assert.Equal(EtagVersion.Empty, sut.Version);
}
[Fact]
public void Should_add_event_to_uncommitted_events_and_increase_version_when_raised()
{
var event1 = new MyEvent();
var event2 = new MyEvent();
sut.RaiseEvent(event1);
sut.RaiseEvent(event2);
Assert.Equal(1, sut.Version);
Assert.Equal(new IEvent[] { event1, event2 }, sut.GetUncomittedEvents().Select(x => x.Payload).ToArray());
sut.ClearUncommittedEvents();
Assert.Equal(0, sut.GetUncomittedEvents().Count);
}
[Fact]
public async Task Should_write_state_and_events_when_saved()
{

Loading…
Cancel
Save