Files
openstack-sdk-dotnet/OpenStack/OpenStack.Test/Identity/IdentityServiceClientDefinitionTests.cs
Wayne Foley 52ca59f4fa Removed the OpenStack.Common assembly and combined it into a single OpenStack assembly.
Refactored the service location code to be compliant with PCLs.
Converted the Openstack assembly into a PCL, and updated the tests.
As part of the PCL converstion minor tweeks to stirng comparison and use of System.Security were updated.

Implements: blueprint convert-to-pcl-lib
Change-Id: I2091d009c506f6ee183d16a817902dfc341fab5a
2014-04-10 10:25:40 -07:00

53 lines
1.5 KiB
C#

using System;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OpenStack.Common;
using OpenStack.Identity;
namespace OpenStack.Test.Identity
{
[TestClass]
public class IdentityServiceClientDefinitionTests
{
public IOpenStackCredential GetValidCredentials()
{
var endpoint = new Uri("https://someidentityendpoint:35357/v2.0/tokens");
var userName = "TestUser";
var password = "RandomPassword";
var tenantId = "12345";
return new OpenStackCredential(endpoint, userName, password, tenantId);
}
[TestMethod]
public void CanSupportVersion2()
{
var client = new IdentityServiceClientDefinition();
Assert.IsTrue(client.IsSupported(GetValidCredentials()));
}
[TestMethod]
public void CannotSupportVersion1()
{
var endpoint = new Uri("https://someidentityendpoint:35357/v1.0/tokens");
var userName = "TestUser";
var password = "RandomPassword";
var tenantId = "12345";
var creds = new OpenStackCredential(endpoint, userName, password, tenantId);
var client = new IdentityServiceClientDefinition();
Assert.IsFalse(client.IsSupported(creds));
}
[TestMethod]
public void Version2Supported()
{
var client = new IdentityServiceClientDefinition();
Assert.IsTrue(client.ListSupportedVersions().Contains("2.0.0.0"));
}
}
}