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

            var request = GetUpsertRequest();

            IActionResult result = tgimbaApi.UpsertBucketListItem(request);

            GoodResultVerify(result);
            tgimbaService.Verify(x => x.UpsertBucketListItem(It.IsAny <BucketListItem>(), It.IsAny <string>(), It.IsAny <string>()), Times.Once);
        }
Beispiel #2
0
        public void UpsertBucketListItem_GeneralErrorTest()
        {
            var tgimbaApi = new SharedTgimbaApiController(this.tgimbaService.Object, this.validationHelper.Object);

            var request = GetUpsertRequest();

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

            IActionResult result = tgimbaApi.UpsertBucketListItem(request);

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

            var request = GetUpsertRequest();

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

            IActionResult result = tgimbaApi.UpsertBucketListItem(request);

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