Beispiel #1
0
        public void WhenCreatedFromPath_ThenToStringReturnsPath()
        {
            var path = "projects/project-1/zones/us-central1-a/machineTypes/n2d-standard-64";

            Assert.AreEqual(
                path,
                MachineTypeLocator.FromString(path).ToString());
        }
Beispiel #2
0
 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(
                                           "/"));
 }
Beispiel #3
0
        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());
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        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);
        }
Beispiel #6
0
 public void WhenPathLacksProject_FromStringThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => MachineTypeLocator.FromString(
                                           "project-1/zones/us-central1-a/machineTypes/n2d-standard-64"));
 }