Example #1
0
        public async Task Handle_ShouldNotCallDelete_WhenBasketDoesntExist()
        {
            var id = Guid.NewGuid();

            var store = new Mock <IBasketStore>();

            var handler = new DeleteBasketRequestHandler(store.Object);

            var request = new DeleteBasketRequest()
            {
                Id = Guid.NewGuid()
            };
            await handler.Handle(request);

            store.Verify(v => v.Delete(id), Times.Never);
        }
Example #2
0
        public async Task Handle_ShouldCallDelete_WhenValid()
        {
            var id = Guid.NewGuid();

            var store = new Mock <IBasketStore>();

            store
            .Setup(s => s.GetById(It.IsAny <Guid>()))
            .Returns(new Models.Domain.Basket());

            var handler = new DeleteBasketRequestHandler(store.Object);

            var request = new DeleteBasketRequest()
            {
                Id = id
            };
            await handler.Handle(request);

            store.Verify(v => v.Delete(id), Times.Once);
        }