public async Task Given() { message = new PlaceOrder { OrderId = Guid.NewGuid() }; var sut = new PlaceOrderHandler(); context = new TestableMessageHandlerContext(); await sut.Handle(message, context); }
public void SetUp() { _discountRepositoryMock = new Mock <IDiscountRepository>(); _identityProviderMock = new Mock <IIdentityProvider>(); _identityProviderMock.Setup(x => x.Next()) .Returns(Guid.NewGuid()); _valueCalculatorMock = new Mock <IValueCalculator>(); _valueCalculatorMock.Setup(x => x.CalculateDiscount(It.IsAny <decimal>(), It.IsAny <Discount>())) .Returns <decimal, Discount>(CalculateDiscount); _orderRepositoryMock = new Mock <IOrderRepository>(); _discountRepositoryMock = new Mock <IDiscountRepository>(); _valueCalculator = new ValueCalculator(); _sut = new PlaceOrderHandler(_discountRepositoryMock.Object, _orderRepositoryMock.Object, _valueCalculator); }