예제 #1
0
        public void AcmeChallenge_WhenConstructedKeyAuthorizationWasReturnedFromAcmeChallengeResolver_ReturnsFileContentResultWhereContentTypeIsEqualToApplicationOctetStream()
        {
            Controller sut = CreateSut();

            FileContentResult result = (FileContentResult)sut.AcmeChallenge(_fixture.Create <string>());

            Assert.That(result.ContentType, Is.EqualTo("application/octet-stream"));
        }
예제 #2
0
        public void AcmeChallenge_WhenConstructedKeyAuthorizationWasReturnedFromAcmeChallengeResolver_ReturnsFileContentResultWhereFileContentsIsNotEmpty()
        {
            Controller sut = CreateSut();

            FileContentResult result = (FileContentResult)sut.AcmeChallenge(_fixture.Create <string>());

            Assert.That(result.FileContents, Is.Not.Empty);
        }
예제 #3
0
        public void AcmeChallenge_WhenConstructedKeyAuthorizationWasReturnedFromAcmeChallengeResolver_ReturnsFileContentResult()
        {
            Controller sut = CreateSut();

            IActionResult result = sut.AcmeChallenge(_fixture.Create <string>());

            Assert.That(result, Is.TypeOf <FileContentResult>());
        }
예제 #4
0
        public void AcmeChallenge_WhenConstructedKeyAuthorizationWasReturnedFromAcmeChallengeResolver_ReturnsFileContentResultWhereFileContentsIsEqualToConstructedKeyAuthorization()
        {
            string     constructedKeyAuthorization = _fixture.Create <string>();
            Controller sut = CreateSut(constructedKeyAuthorization: constructedKeyAuthorization);

            FileContentResult result = (FileContentResult)sut.AcmeChallenge(_fixture.Create <string>());

            Assert.That(Encoding.UTF8.GetString(result.FileContents), Is.EqualTo(constructedKeyAuthorization));
        }
예제 #5
0
        public void AcmeChallenge_WhenChallengeTokenIsNotNullEmptyOrWhiteSpace_AssertGetConstructedKeyAuthorizationWasCalledOnAcmeChallengeResolver()
        {
            Controller sut = CreateSut();

            string challengeToken = _fixture.Create <string>();

            sut.AcmeChallenge(challengeToken);

            _acmeChallengeResolverMock.Verify(m => m.GetConstructedKeyAuthorization(It.Is <string>(value => string.IsNullOrWhiteSpace(value) == false && string.CompareOrdinal(value, challengeToken) == 0)), Times.Once);
        }
예제 #6
0
        public void AcmeChallenge_WhenChallengeTokenIsEmpty_ThrowsIntranetValidationExceptionWhereValidatingTypeIsTypeOfString()
        {
            Controller sut = CreateSut();

            IntranetValidationException result = Assert.Throws <IntranetValidationException>(() => sut.AcmeChallenge(string.Empty));

            Assert.That(result.ValidatingType, Is.EqualTo(typeof(string)));
        }
예제 #7
0
        public void AcmeChallenge_WhenChallengeTokenIsEmpty_ThrowsIntranetValidationExceptionWhereErrorCodeIsEqualToValueCannotBeNullOrWhiteSpace()
        {
            Controller sut = CreateSut();

            IntranetValidationException result = Assert.Throws <IntranetValidationException>(() => sut.AcmeChallenge(string.Empty));

            Assert.That(result.ErrorCode, Is.EqualTo(ErrorCode.ValueCannotBeNullOrWhiteSpace));
        }
예제 #8
0
        public void AcmeChallenge_WhenChallengeTokenIsEmpty_ThrowsIntranetValidationException()
        {
            Controller sut = CreateSut();

            Assert.Throws <IntranetValidationException>(() => sut.AcmeChallenge(string.Empty));
        }
예제 #9
0
        public void AcmeChallenge_WhenChallengeTokenIsNull_ThrowsIntranetValidationExceptionWhereValidatingFieldIsEqualToChallengeToken()
        {
            Controller sut = CreateSut();

            IntranetValidationException result = Assert.Throws <IntranetValidationException>(() => sut.AcmeChallenge(null));

            Assert.That(result.ValidatingField, Is.EqualTo("challengeToken"));
        }
예제 #10
0
        public void AcmeChallenge_WhenNoConstructedKeyAuthorizationWasReturnedFromAcmeChallengeResolver_ThrowsIntranetBusinessExceptionWhereErrorCodeIsEqualToCannotRetrieveAcmeChallengeForToken()
        {
            Controller sut = CreateSut(false);

            IntranetBusinessException result = Assert.Throws <IntranetBusinessException>(() => sut.AcmeChallenge(_fixture.Create <string>()));

            Assert.That(result.ErrorCode, Is.EqualTo(ErrorCode.CannotRetrieveAcmeChallengeForToken));
        }
예제 #11
0
        public void AcmeChallenge_WhenNoConstructedKeyAuthorizationWasReturnedFromAcmeChallengeResolver_ThrowsIntranetBusinessException()
        {
            Controller sut = CreateSut(false);

            Assert.Throws <IntranetBusinessException>(() => sut.AcmeChallenge(_fixture.Create <string>()));
        }
예제 #12
0
        public void AcmeChallenge_WhenChallengeTokenIsWhiteSpace_ThrowsIntranetValidationException()
        {
            Controller sut = CreateSut();

            Assert.Throws <IntranetValidationException>(() => sut.AcmeChallenge(" "));
        }