示例#1
0
        public void ShouldThrowNoResultExceptionWhenNoResultWasReported()
        {
            //GIVEN
            var connectionInProgress = new JsonBasedConnectionInProgress();

            //WHEN - THEN
            new Action(() => connectionInProgress.ToActionResult())
            .Should().ThrowExactly <NoResultException>();
        }
示例#2
0
        public void ShouldReturnInvalidOtherUserIdWhenInvalidOtherUserIdReported()
        {
            //GIVEN
            var connectionInProgress = new JsonBasedConnectionInProgress();

            connectionInProgress.InvalidOtherUserId();

            //WHEN
            var actionResult = connectionInProgress.ToActionResult();

            //THEN
            actionResult.Should().BeOfType <BadRequestObjectResult>()
            .Which.Value.Should().Be("Invalid other user ID.");
        }
示例#3
0
        public void ShouldReturnNoOtherUserFoundWhenNoOtherUserFoundReported()
        {
            //GIVEN
            var connectionInProgress = new JsonBasedConnectionInProgress();

            connectionInProgress.OtherUserNotFound();

            //WHEN
            var actionResult = connectionInProgress.ToActionResult();

            //THEN
            actionResult.Should().BeOfType <BadRequestObjectResult>()
            .Which.Value.Should().Be("Other user not found.");
        }
示例#4
0
        public void ShouldReturnUserConvertedToJsonWhenSuccessReported()
        {
            //GIVEN
            var connectionInProgress = new JsonBasedConnectionInProgress();
            var userDto = Any.Instance <UserDto>();

            connectionInProgress.Success(userDto);

            //WHEN
            var actionResult = connectionInProgress.ToActionResult();

            //THEN
            actionResult.Should().BeOfType <JsonResult>()
            .Which.Value.Should().Be(userDto);
        }