示例#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(" "));
        }