예제 #1
0
    public void Should_BeBackwardCompatible()
    {
        // Given
        var @event = new ShoppingCartInitialized(Guid.NewGuid(), Guid.NewGuid(), ShoppingCartStatus.Pending);
        var json   = JsonSerializer.Serialize(@event);

        // When
        var oldEvent = JsonSerializer.Deserialize <V1.ShoppingCartInitialized>(json);

        oldEvent.Should().NotBeNull();
        oldEvent !.ShoppingCartId.Should().Be(@event.ShoppingCartId);
        oldEvent.ClientId.Should().Be(@event.ClientId);
    }
예제 #2
0
    public void Should_BeForwardCompatible()
    {
        // Given
        var oldEvent = new V1.ShoppingCartInitialized(Guid.NewGuid(), Guid.NewGuid());
        var json     = JsonSerializer.Serialize(oldEvent);

        // When
        var @event = JsonSerializer.Deserialize <ShoppingCartInitialized>(json);

        @event.Should().NotBeNull();
        @event !.ShoppingCartId.Should().Be(oldEvent.ShoppingCartId);
        @event.ClientId.Should().Be(oldEvent.ClientId);
        @event.Status.Should().Be(ShoppingCartStatus.Initialized);
    }