Example #1
0
        public void GetHashCode_Returns_Hash_Code_Based_On_The_Current_Object_Status_When_Using_Populated_Object()
        {
            // Arrange
            const string expectedFolderToPack        = "C:\\Some\\Path\\";
            const string expectedDestinationFilePath = "output.pbo";
            var          runParameters = new RunParameters();

            runParameters.PopulateFromCommandLineArguments(new[] { "-o", "-f", "ArmA3", expectedFolderToPack, expectedDestinationFilePath });

            // Act
            var result = runParameters.GetHashCode();

            // Assert
            Assert.AreEqual(1932353595, result);
        }
Example #2
0
        public void PopulateFromCommandLineArguments_Should_Populate_Object_When_All_Properties_Specified_Correctly()
        {
            // Arrange
            var          runParameters               = new RunParameters();
            const string expectedFolderToPack        = "C:\\Some\\Path\\";
            const string expectedDestinationFilePath = "output.pbo";

            // Act
            runParameters.PopulateFromCommandLineArguments(new[] { "-o", "-f", "ArmA3", expectedFolderToPack, expectedDestinationFilePath });

            // Assert
            Assert.AreEqual(true, runParameters.IsOverwriteEnabled);
            Assert.AreEqual(PboFormat.Arma3, runParameters.PboFormat);
            Assert.AreEqual(expectedFolderToPack, runParameters.FolderToPack);
            Assert.AreEqual(expectedDestinationFilePath, runParameters.DestinationFilePath);
        }
Example #3
0
        public void PopulateFromCommandLineArguments_Should_Throw_ParseException_When_Format_Arg_Cannot_Be_Understood()
        {
            // Arrange
            var            runParameters   = new RunParameters();
            ParseException thrownException = null;

            try
            {
                // Act
                runParameters.PopulateFromCommandLineArguments(new[] { "-f", "foo" });
            }
            catch (ParseException ex)
            {
                thrownException = ex;
            }

            // Assert
            Assert.IsNotNull(thrownException, "Expected exception was not thrown.");
            Assert.AreEqual("It appears the format argument was not supplied or is not a valid format. Please verify the argument and try again.", thrownException.Message);
        }
Example #4
0
        public void PopulateFromCommandLineArguments_Should_Throw_ParseException_When_Args_Null()
        {
            // Arrange
            var            runParameters   = new RunParameters();
            ParseException thrownException = null;

            try
            {
                // Act
                runParameters.PopulateFromCommandLineArguments(null);
            }
            catch (ParseException ex)
            {
                thrownException = ex;
            }

            // Assert
            Assert.IsNotNull(thrownException, "Expected exception was not thrown.");
            Assert.AreEqual("Cannot parse null arguments", thrownException.Message);
        }
Example #5
0
        public void PopulateFromCommandLineArguments_Should_Throw_Exception_When_Unknown_Argument_Specified()
        {
            // Arrange
            var            runParameters               = new RunParameters();
            const string   expectedFolderToPack        = "C:\\Some\\Path\\";
            const string   expectedDestinationFilePath = "output.pbo";
            ParseException thrownException             = null;

            try
            {
                // Act
                runParameters.PopulateFromCommandLineArguments(new[]
                                                               { "-o", "-f", "ArmA3", expectedFolderToPack, expectedDestinationFilePath, "unknownArg" });
            }
            catch (ParseException ex)
            {
                thrownException = ex;
            }

            // Assert
            Assert.IsNotNull(thrownException, "Expected exception was not thrown.");
            Assert.AreEqual("Unknown argument: unknownArg", thrownException.Message);
        }