コード例 #1
0
    public void Given_initial_inventory_item_When_created_event_Then_created_inventory_item()
    {
        // Given
        InventoryItem initialState = InventoryItemEventSourcing.Init;

        // When
        var newState = InventoryItemEventSourcing.Apply(new InventoryEvent.Created(InventoryId, Name), initialState);

        // Then
        Assert.Equal(new InventoryItem(InventoryId, Name, initialState.Count, initialState.Active), newState);
    }
コード例 #2
0
    public void Given_initial_inventory_item_When_create_command_Then_created_event()
    {
        // Given
        InventoryItem initialState = InventoryItemEventSourcing.Init;

        // When
        InventoryEvent @event = InventoryItemEventSourcing.Execute(new InventoryCommand.Create(InventoryId, Name), initialState);

        // Then
        Assert.Equal(new InventoryEvent.Created(InventoryId, Name), @event);
    }