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