示例#1
0
 public bool LoadUnitFromFile(string path)
 {
     try
     {
         UnitRegistry.IndexUnitByPath(path);
         return(true);
     }
     catch { return(false); }
 }
示例#2
0
        public void AddUnitByPath_UnitNotFound_True()
        {
            // Arrange
            UnitRegistry.UnitFiles.Clear();
            UnitRegistry.Units.Clear();

            // Act
            UnitRegistry.IndexUnitByPath($"{DirectoryName}/nonexistent-unit.service");

            // Assert
            Assert.IsNull(UnitRegistry.GetUnit(TestUnitFilename));
        }
示例#3
0
        public void AddUnitByPath_UnitFound_True()
        {
            // Arrange
            UnitRegistry.UnitFiles.Clear();
            UnitRegistry.Units.Clear();

            // Act
            UnitRegistry.IndexUnitByPath(TestUnitPath);

            // Assert
            Assert.IsNotNull(UnitRegistry.GetUnit(TestUnitFilename));
        }