public void ToStringReflectsTheValue() { var expected = "This is the value of the SAS"; var signature = new SettablePropertiesMock(value: expected); Assert.That(signature.ToString(), Is.EqualTo(expected)); }
public void GetTokenIgnoresScopeAndCancellationToken() { var value = "TOkEn!"; var signature = new SettablePropertiesMock(value: value); var credential = new SharedAccessSignatureCredential(signature); Assert.That(credential.GetToken(new[] { "test", "this" }, CancellationToken.None), Is.SameAs(signature.Value), "The credential should return the signature as the token."); }
public void GetTokenReturnsTheSignatureValue() { var value = "TOkEn!"; var signature = new SettablePropertiesMock(value: value); var credential = new SharedAccessSignatureCredential(signature); Assert.That(credential.GetToken(null, default), Is.SameAs(signature.Value), "The credential should return the signature as the token."); }
public async Task GetTokenAsyncIgnoresScopeAndCancellationToken() { var value = "TOkEn!"; var signature = new SettablePropertiesMock(value: value); var credential = new SharedAccessSignatureCredential(signature); var cancellation = new CancellationTokenSource(); var token = await credential.GetTokenAsync(new string[0], cancellation.Token); Assert.That(token, Is.SameAs(signature.Value), "The credential should return the signature as the token."); }
public void ConstructorValidatesInitializesProperties() { var expiration = DateTime.UtcNow; var audience = "the-audience"; var value = "TOkEn!"; var signature = new SettablePropertiesMock("keyName", "key", expiration, audience, value); var credential = new SharedAccessSignatureCredential(signature); Assert.That(credential.SharedAccessSignature, Is.SameAs(signature), "The credential should allow the signature to be accessed."); }
public void ConstructorValidatesInitializesProperties() { var expiration = DateTime.UtcNow; var audience = "the-audience"; var value = "TOkEn!"; var signature = new SettablePropertiesMock("keyName", "key", expiration, audience, value); var token = new TrackOneSharedAccessSignatureToken(signature); Assert.That(token.Audience, Is.EqualTo(audience), "The audience for the token should match the signature resource."); Assert.That(token.TokenValue, Is.EqualTo(value), "The value for the token should match the signature value."); Assert.That(token.ExpiresAtUtc, Is.EqualTo(expiration), "The expiration for the token should match the signature expiration."); Assert.That(token.TokenType, Is.EqualTo(ClientConstants.SasTokenType), "The type for the token should match the expected constant."); }
public void ConstructorValidatesTheSignatureResource() { var signature = new SettablePropertiesMock("keyName", "key", DateTime.UtcNow, "", "token!"); Assert.That(() => new TrackOneSharedAccessSignatureToken(signature), Throws.InstanceOf <ArgumentException>()); }