Пример #1
0
        public async Task DeleteBasket_NullRequest_ThrowsException()
        {
            //Arrange
            var mock   = DeleteBasketMock.Create();
            var target = mock.Target;
            DeleteBasketRequest request = null;

            //Act
            async Task execute() => await target.Execute(request);

            //Assert
            await Assert.ThrowsAsync <ArgumentNullException>(execute);
        }
Пример #2
0
        public async Task DeleteBasket_NullBasketId_ThrowsException()
        {
            //Arrange
            string basketId = null;
            var    mock     = DeleteBasketMock.Create();
            var    target   = mock.Target;
            var    request  = DeleteBasketRequest.Create(basketId);

            //Act
            async Task execute() => await target.Execute(request);

            //Assert
            await Assert.ThrowsAsync <ArgumentException>(execute);
        }
Пример #3
0
        public async Task GetAllBasketsTests_ValidRequest_RepositoryCalledOnce()
        {
            //Arrange
            var basketId = Guid.NewGuid().ToString();
            var mock     = DeleteBasketMock.Create();
            var target   = mock.Target;
            var request  = DeleteBasketRequest.Create(basketId);

            //Act
            await target.Execute(request);

            //Assert
            mock.BasketsRepositoryMock.Verify(rep => rep.Delete(basketId), Times.Once());
        }