public void Index_WhenGetClickWrap_ReturnsCorrectResult(
            Account account,
            User user)
        {
            // Arrange
            InitContext(account, user);
            var clickWrap = new ClickWrap
            {
                ClickwrapId   = "1",
                ClickwrapName = "Covid19Waiver"
            };

            _clickWrapService
            .Setup(c => c.GetClickWrap(It.IsAny <string>()))
            .Returns(() => clickWrap);

            // Act
            IActionResult result = _sut.Index();

            // Assert
            result.Should().BeEquivalentTo(new OkObjectResult
                                               (new ResponseClickWrapModel
            {
                AccountId       = account.Id,
                ClickWrap       = clickWrap,
                DocuSignBaseUrl = account.BaseUri
            }));
        }
        public void Index_WhenPostWithWorkLogs_ReturnsCorrectResult(
            Mock <IClickWrapService> clickWrapService,
            Account account,
            User user)
        {
            // Arrange
            var clickWrapExpected = JsonConvert.SerializeObject(new { clickWrapId = "1" });

            InitContext(account, user);
            clickWrapService.Setup(c => c.CreateTimeTrackClickWrap(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int[]>()))
            .Returns(() => new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(clickWrapExpected)
            });

            var sut = new ClickWrapController(clickWrapService.Object);

            // Act
            var result = sut.Index(new RequestClickWrapModel {
                WorkLogs = new[] { 1, 2, 4 }
            });

            // Assert
            result.Should().BeEquivalentTo(new OkObjectResult
                                               (new ResponseClickWrapModel
            {
                ClickWrap       = JsonConvert.DeserializeObject(clickWrapExpected),
                DocuSignBaseUrl = account.BaseUri
            }));
        }
        public void Index_WhenPostWithModelStateInvalid_ReturnsBadRequestResult()
        {
            // Arrange
            var sut = new ClickWrapController(_clickWrapService.Object);
            // Act
            var result = sut.Index(null);

            // Assert
            Assert.IsType <BadRequestObjectResult>(result);
        }