public void CanAddBuyOrder(TestDbState initialState, TestDbState resultState, BuyOrder buyOrder) { initialState.Apply(DbContext); IAddBuyOrderUseCase sellOrderUseCase = new DealService(BuyOrderRepository, SellOrderRepository, DealRepository); sellOrderUseCase.AddBuyOrder(buyOrder); resultState.AssertState(DbContext); }
public static IEnumerable <object[]> SellOrderTestData() { yield return(new object[] { TestDbState.Create() .AddOrder(new BuyOrder { Price = 43m, Qty = 10, Email = "*****@*****.**" }) .AddOrder(new BuyOrder { Price = 35m, Qty = 15, Email = "*****@*****.**" }) .AddOrder(new BuyOrder { Price = 31m, Qty = 20, Email = "*****@*****.**" }) .AddOrder(new BuyOrder { Price = 20m, Qty = 20, Email = "*****@*****.**" }), TestDbState.Create() .AddOrder(new SellOrder { Price = 33m, Qty = 75, Email = "*****@*****.**" }) .AddOrder(new BuyOrder { Price = 31m, Qty = 20, Email = "*****@*****.**" }) .AddOrder(new BuyOrder { Price = 20m, Qty = 20, Email = "*****@*****.**" }) .AddDeal(new Deal { BuyerEmail = "*****@*****.**", SellerEmail = "*****@*****.**", Price = 43m, Qty = 10, }) .AddDeal(new Deal { BuyerEmail = "*****@*****.**", SellerEmail = "*****@*****.**", Price = 35m, Qty = 15, }), new SellOrder { Price = 33m, Qty = 100, Email = "*****@*****.**" } }); }
public static IEnumerable <object[]> BuyOrderTestData() { yield return(new object[] { TestDbState.Create(), TestDbState.Create() .AddOrder(new BuyOrder { Price = 33m, Qty = 100, Email = "*****@*****.**" }), new BuyOrder { Price = 33m, Qty = 100, Email = "*****@*****.**" } }); yield return(new object[] { TestDbState.Create() .AddOrder(new SellOrder { Price = 45m, Qty = 5, Email = "*****@*****.**" }) .AddOrder(new SellOrder { Price = 50m, Qty = 100, Email = "*****@*****.**" }) .AddOrder(new SellOrder { Price = 55m, Qty = 5, Email = "*****@*****.**" }), TestDbState.Create() .AddOrder(new SellOrder { Price = 50m, Qty = 90, Email = "*****@*****.**" }) .AddOrder(new SellOrder { Price = 55m, Qty = 5, Email = "*****@*****.**" }) .AddDeal(new Deal { BuyerEmail = "*****@*****.**", SellerEmail = "*****@*****.**", Price = 45m, Qty = 5 }) .AddDeal(new Deal { BuyerEmail = "*****@*****.**", SellerEmail = "*****@*****.**", Price = 50m, Qty = 10 }), new BuyOrder { Price = 50m, Qty = 15, Email = "*****@*****.**" } }); yield return(new object[] { TestDbState.Create() .AddOrder(new SellOrder { Price = 35m, Qty = 5, Email = "*****@*****.**" }) .AddOrder(new SellOrder { Price = 30m, Qty = 10, Email = "*****@*****.**" }), TestDbState.Create() .AddOrder(new BuyOrder { Price = 50m, Qty = 100, Email = "*****@*****.**" }) .AddDeal(new Deal { BuyerEmail = "*****@*****.**", SellerEmail = "*****@*****.**", Price = 35m, Qty = 5 }) .AddDeal(new Deal { BuyerEmail = "*****@*****.**", SellerEmail = "*****@*****.**", Price = 30m, Qty = 10 }), new BuyOrder { Price = 50m, Qty = 115, Email = "*****@*****.**" } }); }