Пример #1
0
        public void ReadExcludedLocations_InvalidValueInReadLocation_ThrowsCriticalFileReadException()
        {
            // Setup
            using (var reader = new HydraRingSettingsDatabaseReader(invalidDatabasePath))
            {
                // Call
                TestDelegate test = () => reader.ReadExcludedLocations().ToArray();

                // Assert
                Assert.Throws <CriticalFileReadException>(test);
            }
        }
Пример #2
0
        public void ReadExcludedLocations_EmptyTable_ReturnsEmptyEnumerable()
        {
            // Setup
            using (var reader = new HydraRingSettingsDatabaseReader(emptyDatabasePath))
            {
                // Call
                IEnumerable <long> locations = reader.ReadExcludedLocations();

                // Assert
                CollectionAssert.IsEmpty(locations);
            }
        }
Пример #3
0
 private ReadResult <IEnumerable <long> > ReadExcludedLocations(HydraRingSettingsDatabaseReader reader)
 {
     try
     {
         return(new ReadResult <IEnumerable <long> >(false)
         {
             Items = new[]
             {
                 reader.ReadExcludedLocations().ToArray()
             }
         });
     }
     catch (CriticalFileReadException e)
     {
         return(HandleCriticalFileReadError <IEnumerable <long> >(e.Message));
     }
 }
Пример #4
0
        public void ReadExcludedLocations_TableWithRows_ReturnsAllLocationIdsInTable()
        {
            // Setup
            using (var reader = new HydraRingSettingsDatabaseReader(completeDatabasePath))
            {
                // Call
                IEnumerable <long> locations = reader.ReadExcludedLocations();

                // Assert
                CollectionAssert.AreEqual(new[]
                {
                    700141,
                    700142,
                    700143,
                    700146
                }, locations);
            }
        }