public void Entity_GetChanges_CommandsExecuted_EventsReturned() { //Arrange var guid = Guid.Parse("5ffdfca6-2cb6-4a22-8943-339a65298a2b"); var ta = TestAggregate.Create(TestAggregateId.FromGuid(guid), StringValue.FromString("testtest"), BoolValue.FromBool(true)); var teGuid = Guid.Parse("12c9077f-ddc1-4ded-bbc6-ff816d384788"); ta.AddEntity(TestEntityId.FromGuid(teGuid), StringValue.FromString("entity")); //Act var changes = ta.GetChanges(); //Arrange Assert.AreEqual(2, changes.Count); Assert.IsTrue(changes[0] is CreatedEvent); Assert.IsTrue(changes[1] is TestEntityAddedToTestAggregateEvent); }
public void CanSerializeToJson() { var entity = TestAggregate.Create(); var json = WriteJson(entity); Validate(json, @" { ""$type"": ""Test.Spark.Serialization.Converters.UsingStateObjectConverter.TestAggregate, Spark.Serialization.Newtonsoft.Tests"", ""c"": [ { ""$type"": ""Test.Spark.Serialization.Converters.UsingStateObjectConverter.TestEntity, Spark.Serialization.Newtonsoft.Tests"", ""id"": ""8cb5f171-5505-4313-b8a8-0345d70cfb46"", ""n"": ""My Entity"" } ], ""d"": 8.9, ""f"": 456.7, ""i"": 123, ""n"": ""My Aggregate"", ""s"": 1, ""t"": ""2013-07-01T00:00:00"" }"); }
public void SetUp() { this.aggregate = TestAggregate.Create(1978); this.aggregate.Commit(); }