public void WhenCreatedFromPath_ThenToStringReturnsPath() { var path = "projects/project-1"; Assert.AreEqual( path, ProjectLocator.FromString(path).ToString()); }
public void WhenQualifiedByGoogleapisHost_FromStringReturnsObject() { var ref1 = ProjectLocator.FromString( "https://www.googleapis.com/compute/v1/projects/project-1"); Assert.AreEqual("projects", ref1.ResourceType); Assert.AreEqual("project-1", ref1.Name); Assert.AreEqual("project-1", ref1.ProjectId); }
public void WhenPathIsValid_FromStringReturnsObject() { var ref1 = ProjectLocator.FromString( "projects/project-1"); Assert.AreEqual("projects", ref1.ResourceType); Assert.AreEqual("project-1", ref1.Name); Assert.AreEqual("project-1", ref1.ProjectId); }
public void WhenCreatedFromUrl_ThenToStringReturnsPath() { var path = "projects/project-1"; Assert.AreEqual( path, ProjectLocator.FromString( "https://www.googleapis.com/compute/v1/" + path).ToString()); }
public void WhenPathInvalid_FromStringThrowsArgumentException() { Assert.Throws <ArgumentException>(() => ProjectLocator.FromString( "projects/project-1/zone")); Assert.Throws <ArgumentException>(() => ProjectLocator.FromString("")); }
public void WhenPathLacksProject_FromStringThrowsArgumentException() { Assert.Throws <ArgumentException>(() => ProjectLocator.FromString( "/project-1")); }