public void CannotConvertJsonPayloadMissingToken() { var missingTokenFixture = @"{ ""access"": { } }"; var converter = new AccessTokenPayloadConverter(); converter.Convert(missingTokenFixture); }
public void CannotConvertJsonPayloadMissingTokenId() { var missingTokenIdFixture = @"{ ""access"": { ""token"": { ""expires"": ""2014-03-18T10:59:46.355Z"", ""tenant"": { ""id"": ""10244656540440"", ""name"": ""10255892528404-Project"" } } } }"; var converter = new AccessTokenPayloadConverter(); converter.Convert(missingTokenIdFixture); }
public void CanConvertJsonPayload() { var AuthJsonResponseFixture = @"{ ""access"": { ""token"": { ""expires"": ""2014-03-18T10:59:46.355Z"", ""id"": ""HPAuth10_af3d1bfe456d18e8d4793e54922f839fa051d9f60f115aca52c9a44f9e3d96fb"", ""tenant"": { ""id"": ""10244656540440"", ""name"": ""10255892528404-Project"" } } } }"; var expectedToken = "HPAuth10_af3d1bfe456d18e8d4793e54922f839fa051d9f60f115aca52c9a44f9e3d96fb"; var converter = new AccessTokenPayloadConverter(); var token = converter.Convert(AuthJsonResponseFixture); Assert.IsNotNull(token); Assert.AreEqual(expectedToken, token); }
public void CannotConvertInvalidJson() { var badJsonFixture = @"{ NOT JSON"; var converter = new AccessTokenPayloadConverter(); converter.Convert(badJsonFixture); }
public void CannotConvertJsonPayloadEmptyObject() { var emptyObjectFixture = @"{ }"; var converter = new AccessTokenPayloadConverter(); converter.Convert(emptyObjectFixture); }
public void CannotConvertNonObjectJson() { var nonObjectJson = @"[]"; var converter = new AccessTokenPayloadConverter(); converter.Convert(nonObjectJson); }