public void WhenCreatedFromUrl_ThenToStringReturnsPath() { var path = "projects/project-1/zones/us-central1-a/diskTypes/pd-standard"; Assert.AreEqual( path, DiskTypeLocator.FromString( "https://www.googleapis.com/compute/v1/" + path).ToString()); }
public void WhenUsingBetaApi_FromStringReturnsObject() { var ref1 = DiskTypeLocator.FromString( "https://compute.googleapis.com/compute/beta/projects/project-1/zones/us-central1-a/diskTypes/pd-standard"); Assert.AreEqual("diskTypes", ref1.ResourceType); Assert.AreEqual("pd-standard", ref1.Name); Assert.AreEqual("us-central1-a", ref1.Zone); Assert.AreEqual("project-1", ref1.ProjectId); }
public void WhenPathIsValid_FromStringReturnsObject() { var ref1 = DiskTypeLocator.FromString( "projects/project-1/zones/us-central1-a/diskTypes/pd-standard"); Assert.AreEqual("diskTypes", ref1.ResourceType); Assert.AreEqual("pd-standard", ref1.Name); Assert.AreEqual("us-central1-a", ref1.Zone); Assert.AreEqual("project-1", ref1.ProjectId); }
public void WhenPathLacksProject_FromStringThrowsArgumentException() { Assert.Throws <ArgumentException>(() => DiskTypeLocator.FromString( "/project-1/zones/us-central1-a/diskTypes/pd-standard")); }