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")); }
public void AcmeChallenge_WhenConstructedKeyAuthorizationWasReturnedFromAcmeChallengeResolver_ReturnsFileContentResultWhereFileContentsIsNotEmpty() { Controller sut = CreateSut(); FileContentResult result = (FileContentResult)sut.AcmeChallenge(_fixture.Create <string>()); Assert.That(result.FileContents, Is.Not.Empty); }
public void AcmeChallenge_WhenConstructedKeyAuthorizationWasReturnedFromAcmeChallengeResolver_ReturnsFileContentResult() { Controller sut = CreateSut(); IActionResult result = sut.AcmeChallenge(_fixture.Create <string>()); Assert.That(result, Is.TypeOf <FileContentResult>()); }
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)); }
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); }
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))); }
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)); }
public void AcmeChallenge_WhenChallengeTokenIsEmpty_ThrowsIntranetValidationException() { Controller sut = CreateSut(); Assert.Throws <IntranetValidationException>(() => sut.AcmeChallenge(string.Empty)); }
public void AcmeChallenge_WhenChallengeTokenIsNull_ThrowsIntranetValidationExceptionWhereValidatingFieldIsEqualToChallengeToken() { Controller sut = CreateSut(); IntranetValidationException result = Assert.Throws <IntranetValidationException>(() => sut.AcmeChallenge(null)); Assert.That(result.ValidatingField, Is.EqualTo("challengeToken")); }
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)); }
public void AcmeChallenge_WhenNoConstructedKeyAuthorizationWasReturnedFromAcmeChallengeResolver_ThrowsIntranetBusinessException() { Controller sut = CreateSut(false); Assert.Throws <IntranetBusinessException>(() => sut.AcmeChallenge(_fixture.Create <string>())); }
public void AcmeChallenge_WhenChallengeTokenIsWhiteSpace_ThrowsIntranetValidationException() { Controller sut = CreateSut(); Assert.Throws <IntranetValidationException>(() => sut.AcmeChallenge(" ")); }