diff --git a/rails_application/test/client_orders/discount_test.rb b/rails_application/test/client_orders/discount_test.rb index 6127ed84..29e3990c 100644 --- a/rails_application/test/client_orders/discount_test.rb +++ b/rails_application/test/client_orders/discount_test.rb @@ -69,7 +69,7 @@ def change_percentage_discount(order_id) end def item_added_to_basket(order_id, product_id) - event_store.publish(Ordering::ItemAddedToBasket.new(data: { product_id: product_id, order_id: order_id, quantity_before: 0 })) + run_command(Pricing::AddPriceItem.new(product_id: product_id, order_id: order_id)) end def prepare_product(product_id) diff --git a/rails_application/test/client_orders/item_added_to_basket_test.rb b/rails_application/test/client_orders/item_added_to_basket_test.rb index 4d90e9ac..dbfce067 100644 --- a/rails_application/test/client_orders/item_added_to_basket_test.rb +++ b/rails_application/test/client_orders/item_added_to_basket_test.rb @@ -152,7 +152,6 @@ def test_add_another_item data: { order_id: order_id, product_id: another_product_id, - quantity_before: 0 } ) ) diff --git a/rails_application/test/client_orders/item_removed_from_basket_test.rb b/rails_application/test/client_orders/item_removed_from_basket_test.rb index 2b932c37..949d25ed 100644 --- a/rails_application/test/client_orders/item_removed_from_basket_test.rb +++ b/rails_application/test/client_orders/item_removed_from_basket_test.rb @@ -33,25 +33,23 @@ def test_remove_item_when_quantity_gt_1 ) order_id = SecureRandom.uuid event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 0 } ) ) event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 1 } ) ) event_store.publish( - Ordering::ItemRemovedFromBasket.new( + Pricing::PriceItemRemoved.new( data: { order_id: order_id, product_id: product_id @@ -82,16 +80,15 @@ def test_remove_item_when_quantity_eq_1 ) order_id = SecureRandom.uuid event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 0 } ) ) event_store.publish( - Ordering::ItemRemovedFromBasket.new( + Pricing::PriceItemRemoved.new( data: { order_id: order_id, product_id: product_id @@ -140,34 +137,31 @@ def test_remove_item_when_there_is_another_item ) order_id = SecureRandom.uuid event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 0 } ) ) event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 1 } ) ) event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: another_product_id, - quantity_before: 0 } ) ) event_store.publish( - Ordering::ItemRemovedFromBasket.new( + Pricing::PriceItemRemoved.new( data: { order_id: order_id, product_id: another_product_id diff --git a/rails_application/test/client_orders/update_order_total_value_test.rb b/rails_application/test/client_orders/update_order_total_value_test.rb index da0bc7b4..205b461e 100644 --- a/rails_application/test/client_orders/update_order_total_value_test.rb +++ b/rails_application/test/client_orders/update_order_total_value_test.rb @@ -20,7 +20,7 @@ def test_order_created_has_draft_state private def item_added_to_basket(order_id, product_id) - event_store.publish(Ordering::ItemAddedToBasket.new(data: { product_id: product_id, order_id: order_id, quantity_before: 0 })) + event_store.publish(Pricing::PriceItemAdded.new(data: { product_id: product_id, order_id: order_id })) end def prepare_product(product_id) diff --git a/rails_application/test/orders/broadcast_test.rb b/rails_application/test/orders/broadcast_test.rb index 9c2bc0e9..6e0c2df3 100644 --- a/rails_application/test/orders/broadcast_test.rb +++ b/rails_application/test/orders/broadcast_test.rb @@ -40,11 +40,10 @@ def test_broadcast_add_item_to_basket in_memory_broadcast.result.clear event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 0 } ) ) @@ -68,18 +67,17 @@ def test_broadcast_remove_item_from_basket order_id = SecureRandom.uuid event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 0 } ) ) in_memory_broadcast.result.clear event_store.publish( - Ordering::ItemRemovedFromBasket.new( + Pricing::PriceItemRemoved.new( data: { order_id: order_id, product_id: product_id, @@ -108,20 +106,18 @@ def test_broadcast_update_order_value ) run_command(Pricing::SetPrice.new(product_id: product_id, price: 20)) event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 0 } ) ) event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_1_id, product_id: product_id, - quantity_before: 0 } ) ) @@ -170,20 +166,18 @@ def test_broadcast_update_discount ) run_command(Pricing::SetPrice.new(product_id: product_id, price: 20)) event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 0 } ) ) event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_1_id, product_id: product_id, - quantity_before: 0 } ) ) diff --git a/rails_application/test/orders/discount_test.rb b/rails_application/test/orders/discount_test.rb index 27482ee5..bd9d9de7 100644 --- a/rails_application/test/orders/discount_test.rb +++ b/rails_application/test/orders/discount_test.rb @@ -86,7 +86,7 @@ def change_percentage_discount(order_id) end def item_added_to_basket(order_id, product_id) - event_store.publish(Ordering::ItemAddedToBasket.new(data: { product_id: product_id, order_id: order_id, quantity_before: 0 })) + run_command(Pricing::AddPriceItem.new(product_id: product_id, order_id: order_id )) end def prepare_product(product_id) diff --git a/rails_application/test/orders/order_expired_test.rb b/rails_application/test/orders/order_expired_test.rb index 59e5534b..fef4ddf3 100644 --- a/rails_application/test/orders/order_expired_test.rb +++ b/rails_application/test/orders/order_expired_test.rb @@ -27,11 +27,10 @@ def test_expire_created_order order_id = SecureRandom.uuid order_number = Ordering::FakeNumberGenerator::FAKE_NUMBER event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 0 } ) ) diff --git a/rails_application/test/orders/order_placed_test.rb b/rails_application/test/orders/order_placed_test.rb index 1a69cf23..a378a781 100644 --- a/rails_application/test/orders/order_placed_test.rb +++ b/rails_application/test/orders/order_placed_test.rb @@ -25,11 +25,10 @@ def test_create_when_not_exists order_number = Ordering::FakeNumberGenerator::FAKE_NUMBER event_store.publish( - Ordering::ItemAddedToBasket.new( + Pricing::PriceItemAdded.new( data: { order_id: order_id, product_id: product_id, - quantity_before: 0 } ) ) diff --git a/rails_application/test/orders/update_order_total_value_test.rb b/rails_application/test/orders/update_order_total_value_test.rb index 50f432b6..7426999e 100644 --- a/rails_application/test/orders/update_order_total_value_test.rb +++ b/rails_application/test/orders/update_order_total_value_test.rb @@ -36,7 +36,7 @@ def test_newest_event_is_always_applied private def item_added_to_basket(order_id, product_id) - event_store.publish(Ordering::ItemAddedToBasket.new(data: { product_id: product_id, order_id: order_id, quantity_before: 0 })) + event_store.publish(Pricing::PriceItemAdded.new(data: { product_id: product_id, order_id: order_id })) end def prepare_product(product_id)