Ejemplo n.º 1
0
 public bool LoadUnitFromFile(string path)
 {
     try
     {
         UnitRegistry.IndexUnitByPath(path);
         return(true);
     }
     catch { return(false); }
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 3
0
        public void AddUnitByPath_UnitFound_True()
        {
            // Arrange
            UnitRegistry.UnitFiles.Clear();
            UnitRegistry.Units.Clear();

            // Act
            UnitRegistry.IndexUnitByPath(TestUnitPath);

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