Example #1
0
        public async Task GetBasketsById_NullRequest_ThrowsException()
        {
            //Arrange
            var mock   = GetBasketsByIdMock.Create();
            var target = mock.Target;
            GetBasketsByIdRequest request = null;

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

            //Assert
            await Assert.ThrowsAsync <ArgumentNullException>(execute);
        }
Example #2
0
        public async Task GetBasketsById_NullBasketId_ThrowsException()
        {
            //Arrange
            string basketId = null;
            var    mock     = GetBasketsByIdMock.Create();
            var    target   = mock.Target;
            var    request  = GetBasketsByIdRequest.Create(basketId);

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

            //Assert
            await Assert.ThrowsAsync <ArgumentException>(execute);
        }
Example #3
0
        public async Task GetBasketsById_WithId_ReturnsBasket()
        {
            //Arrange
            var basketId = Guid.NewGuid().ToString();
            var mock     = GetBasketsByIdMock.Create();
            var target   = mock.Target;
            var request  = GetBasketsByIdRequest.Create(basketId);

            //Act
            var actual = await target.Execute(request);

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