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); }
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); }
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); }