public FakeCommand()
 {
     Id        = CommandId.From(Guid.Empty.ToString());
     Subject   = Guid.NewGuid().ToString();
     Timestamp = DateTimeOffset.MaxValue;
     Version   = 1;
 }
 public FakeCommand()
 {
     Id            = CommandId.From(Guid.Empty.ToString());
     Subject       = Guid.Empty.ToString();
     CorrelationId = OpenEventSourcing.CorrelationId.From(Guid.Empty.ToString());
     Timestamp     = DateTimeOffset.MaxValue;
     Version       = 3;
 }
        public override CommandId?ReadJson(JsonReader reader, Type objectType, CommandId?existingValue, bool hasExistingValue,
                                           JsonSerializer serializer)
        {
            var value = serializer.Deserialize <string>(reader);

            if (value == null)
            {
                return(null);
            }

            return(CommandId.From(value));
        }
        public void WhenDataIsNotNullThenShouldSerializeWithExpectedValueNonGeneric()
        {
            var serializer = new JsonCommandDeserializer();

            var result = (FakeCommand)serializer.Deserialize(_json, typeof(FakeCommand));

            result.Should().NotBeNull();
            result.Id.Should().Be(CommandId.From(Guid.Empty.ToString()));
            result.Subject.Should().Be(Guid.Empty.ToString());
            result.CorrelationId.Should().Be(CorrelationId.From(Guid.Empty.ToString()));
            result.Timestamp.Should().Be(DateTimeOffset.MaxValue);
            result.Version.Should().Be(3);
            result.Actor.Should().BeEquivalentTo(Actor.From("User"));
        }