示例#1
0
        public void InvalidXmlToTimetableTest()
        {
            var testDataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testdata", "fet", "invalid.xml");
            var testData     = File.ReadAllBytes(testDataPath);

            // Create dummy FET output
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { @"Hopwood\Hopwood_activities.xml", new MockFileData(testData) }
            });

            // Run
            var fop = new FetOutputProcessor("Hopwood", fileSystem.Directory.GetCurrentDirectory(), fileSystem);

            // Invalid XML throws InvalidOperationException
            Assert.Throws <InvalidOperationException>(() => fop.GetTimetable(null));
        }
示例#2
0
        public void EmptyXmlToTimetableTest()
        {
            var testDataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testdata", "fet", "empty.xml");
            var testData     = File.ReadAllBytes(testDataPath);

            // Create dummy FET output
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { @"Hopwood\Hopwood_activities.xml", new MockFileData(testData) }
            });

            // Run
            var fop = new FetOutputProcessor("Hopwood", fileSystem.Directory.GetCurrentDirectory(), fileSystem);
            var tt  = fop.GetTimetable(null);

            // Check that we have found all 163 activities
            Assert.AreEqual(0, tt.Activities.Count);
        }
示例#3
0
        public void GetTimetableTest()
        {
            var testDataPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testdata/fet/United-Kingdom/Hopwood/output.xml");
            var testData     = File.ReadAllBytes(testDataPath);

            // Create dummy FET output
            var fileSystem = new MockFileSystem(new Dictionary <string, MockFileData>
            {
                { @"Hopwood\Hopwood_activities.xml", new MockFileData(testData) },
                { @"Hopwood\Hopwood_data_and_timetable.fet", new MockFileData("Original FET file") },
                { @"Hopwood\Hopwood_soft_conflicts.txt", new MockFileData("Soft conflicts in solution") }
            });

            // Run
            var fop = new FetOutputProcessor("Hopwood", fileSystem.Directory.GetCurrentDirectory(), fileSystem);

            var tt = fop.GetTimetable(null);

            // Check that we have found all 163 activities
            Assert.AreEqual(163, tt.Activities.Count);
        }