Esempio n. 1
0
        public void WhenCreatedFromPath_ThenToStringReturnsPath()
        {
            var path = "projects/project-1";

            Assert.AreEqual(
                path,
                ProjectLocator.FromString(path).ToString());
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public void WhenCreatedFromUrl_ThenToStringReturnsPath()
        {
            var path = "projects/project-1";

            Assert.AreEqual(
                path,
                ProjectLocator.FromString(
                    "https://www.googleapis.com/compute/v1/" + path).ToString());
        }
Esempio n. 5
0
 public void WhenPathInvalid_FromStringThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => ProjectLocator.FromString(
                                           "projects/project-1/zone"));
     Assert.Throws <ArgumentException>(() => ProjectLocator.FromString(""));
 }
Esempio n. 6
0
 public void WhenPathLacksProject_FromStringThrowsArgumentException()
 {
     Assert.Throws <ArgumentException>(() => ProjectLocator.FromString(
                                           "/project-1"));
 }