public void MssqlSnapShotDataStoreSerializeShouldCreateCorrectStringWhenCalledWithADomainEvent() { var configuration = new Mock <IConfigurationRegistry>(); configuration.Setup(s => s.GetValue <string>("connection")).Returns("connection"); var serialized = new SnapShotDatastore("connection", "tableName", new Mock <IPerformanceMeasurementService>().Object, configuration.Object).Serialize(_testAggregate); serialized.Should().Contain("StockTradingAnalysis.Domain.Events.Snapshots.StockAggregateSnapshot, StockTradingAnalysis.Domain.Events"); serialized.Should().Contain("Name"); serialized.Should().Contain("WKN"); serialized.Should().Contain("Type"); serialized.Should().Contain("long"); serialized.Should().Contain("StockTradingAnalysis.Interfaces.Domain.IQuotation"); serialized.Should().Contain("a750f2cc-2452-4bce-b720-e9bd647b936b"); }
public void MssqlSnapShotDataStoreDeserializeShouldCreateCorrectDomainEventWhenCalledWithAValidString() { var configuration = new Mock <IConfigurationRegistry>(); configuration.Setup(s => s.GetValue <string>("connection")).Returns("connection"); var deserialized = new SnapShotDatastore("connection", "tableName", new Mock <IPerformanceMeasurementService>().Object, configuration.Object).Deserialize <StockAggregateSnapshot>(_testAggregateSerialized); deserialized.AggregateId.Should().Be(Guid.Parse("a750f2cc-2452-4bce-b720-e9bd647b936b")); deserialized.Id.Should().Be(Guid.Parse("9745ad72-cca6-4701-9090-11d829d9ad4c")); deserialized.LongShort.Should().Be("long"); deserialized.Name.Should().Be("Name"); deserialized.Type.Should().Be("Type"); deserialized.Wkn.Should().Be("WKN"); deserialized.Version.Should().Be(1); deserialized.Quotations.First().Changed.Should().Be(DateTime.Parse("2018-01-23T17:06:42.418107+01:00")); deserialized.Quotations.First().Date.Should().Be(DateTime.Parse("2018-01-23T17:06:42.418107+01:00")); deserialized.Quotations.First().Open.Should().Be(1); deserialized.Quotations.First().Close.Should().Be(2); deserialized.Quotations.First().High.Should().Be(3); deserialized.Quotations.First().Low.Should().Be(4); }