예제 #1
0
        public void ValidateOwnersLines(TestAndExpected entry)
        {
            CodeOwnerEntry coe = new CodeOwnerEntry(entry.PathAndOwners, entry.LabelsLine);

            Assert.AreEqual(entry.ExpectedLabels, coe.Labels);
            Assert.AreEqual(entry.ExpectedOwners, coe.Owners);
            Assert.AreEqual(entry.ExpectedPath, coe.PathExpression);
        }
예제 #2
0
        public void ValidateOwnersLines(TestAndExpected entry)
        {
            // create the content
            string content = $"{entry.LabelsLine}\r\n{entry.PathAndOwners}";

            CodeOwnerEntry coe = CodeOwnersFile.ParseContent(content).First();

            Assert.AreEqual(entry.ExpectedLabels, coe.PRLabels);
            Assert.AreEqual(entry.ExpectedOwners, coe.Owners);
            Assert.AreEqual(entry.ExpectedPath, coe.PathExpression);
        }
예제 #3
0
        public void ParseInvalidEntry()
        {
            // no path and owners
            var entry = new TestAndExpected("", "# PRLabel: %label1 %label2", string.Empty, new string[] { }, new string[] { "label1", "label2" });

            // create the content
            string content = $"{entry.LabelsLine}\r\n{entry.PathAndOwners}";

            CodeOwnerEntry coe = CodeOwnersFile.ParseContent(content).FirstOrDefault();

            Assert.IsNull(coe);
        }