예제 #1
0
        public void DeleteBucketListItem_HappyPathTest()
        {
            var tgimbaApi = new SharedTgimbaApiController(this.tgimbaService.Object, this.validationHelper.Object);

            var request = GetDeleteListItemRequest();

            IActionResult result = tgimbaApi.DeleteBucketListItem(request.EncodedUserName, request.EncodedToken, request.BucketListItemId);

            GoodResultVerify(result);
            tgimbaService.Verify(x => x.DeleteBucketListItem(It.IsAny <int>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once);
        }
예제 #2
0
        public void DeleteBucketListItem_GeneralErrorTest()
        {
            var tgimbaApi = new SharedTgimbaApiController(this.tgimbaService.Object, this.validationHelper.Object);

            var request = GetDeleteListItemRequest();

            tgimbaService.Setup(x => x.DeleteBucketListItem(
                                    It.IsAny <int>(), It.IsAny <string>(),
                                    It.IsAny <string>()))
            .Throws(new Exception("I am an exception"));

            IActionResult result = tgimbaApi.DeleteBucketListItem(request.EncodedUserName, request.EncodedToken, request.BucketListItemId);

            BadResultVerify(result, 500);
        }
예제 #3
0
        public void DeleteBucketListItem_ValidationErrorTest()
        {
            var tgimbaApi = new SharedTgimbaApiController(this.tgimbaService.Object, this.validationHelper.Object);

            var request = GetDeleteListItemRequest();

            validationHelper.Setup(x => x.IsValidRequest
                                       (It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>()))
            .Throws(new ArgumentNullException(""));

            IActionResult result = tgimbaApi.DeleteBucketListItem(request.EncodedUserName, request.EncodedToken, request.BucketListItemId);

            BadResultVerify(result);
            tgimbaService.Verify(x => x.DeleteBucketListItem(
                                     It.IsAny <int>(), It.IsAny <string>(),
                                     It.IsAny <string>()), Times.Never);
        }