Exemple #1
0
        public void TestMethod1()
        {
            //Arrange
            TaskAllocations test = new TaskAllocations("Test1.tan");

            //Act
            TaskAllocations.TryParse("Test1.tan", out test);
            //Assert
        }
Exemple #2
0
        public void AllocationsTest()
        {
            //Arrange
            int expectedAllocations = 8;

            //Act
            TaskAllocations test = new TaskAllocations(test1FilePath);

            TaskAllocations.TryParse(test1FilePath, out test);
            int allocations = test.NumAllocations;

            //Assert
            Assert.AreEqual(expectedAllocations, allocations, "ALLOCATIONS is incorrect in Test1.tan");
        }
Exemple #3
0
        public void ProcessorsTest()
        {
            //Arrange
            int expectedProcessors = 3;

            //Act
            TaskAllocations test = new TaskAllocations(test1FilePath);

            TaskAllocations.TryParse(test1FilePath, out test);
            int processors = test.Processors;

            //Assert
            Assert.AreEqual(expectedProcessors, processors, "PROCESSORS is incorrect in Test1.tan");
        }
Exemple #4
0
        public void TasksTest()
        {
            //Arrange
            int expectedTasks = 5;

            //Act
            TaskAllocations test = new TaskAllocations(test1FilePath);

            TaskAllocations.TryParse(test1FilePath, out test);
            int tasks = test.Tasks;

            //Assert
            Assert.AreEqual(expectedTasks, tasks, "TASKS is incorrect in Test1.tan");
        }
Exemple #5
0
        public void ConfigFileTest()
        {
            //Arrange
            string expectedConfigFile = "Test1.csv";

            //Act
            TaskAllocations test = new TaskAllocations(test1FilePath);

            TaskAllocations.TryParse(test1FilePath, out test);
            string configFile = test.ConfigPath;

            //Assert
            Assert.AreEqual(expectedConfigFile, configFile, "CONFIGURATION path is incorrect in Test1.tan");
        }
Exemple #6
0
        public void AllocationRuntimeTest1()
        {
            //Arrange
            string        tanPath      = "C:\\Users\\Tyson\\source\\repos\\SIT323Assignment1\\Files for Unit Testing\\Test1.tan";
            string        configPath   = "C:\\Users\\Tyson\\source\\repos\\SIT323Assignment1\\Files for Unit Testing\\Test1.csv";
            double        expectedTime = 2.61;
            List <string> errors       = new List <string>();

            //Act
            TaskAllocations.TryParse(tanPath, out TaskAllocations aTaskAllocation);
            Configuration.TryParse(configPath, out Configuration aConfiguration);
            double actualtime = Math.Round(aTaskAllocation.SetOfAllocations[0].CalculateTime(aConfiguration, out errors), 2);

            //Assert
            Assert.AreEqual(expectedTime, actualtime);
        }
Exemple #7
0
        public void AllocationID2Test()
        {
            //Arrange
            int expectedID = 2;

            double[,] expectedMatrix1 = { { 1, 1, 0, 0, 0 }, { 0, 0, 0, 0, 1 }, { 0, 0, 1, 1, 0 } };

            //Act
            TaskAllocations test = new TaskAllocations(test1FilePath);

            TaskAllocations.TryParse(test1FilePath, out test);
            int id = test.SetOfAllocations[1].ID;

            double[,] matrix = test.SetOfAllocations[1].AllocationMatrix;

            //Assert
            Assert.AreEqual(expectedID, id, "ALLOCATION-ID 2 has incorrect ID");
            CollectionAssert.AreEqual(expectedMatrix1, matrix, "ALLOCATION-ID 2 is incorrect in Test1.tan");
        }