Пример #1
0
        public void ReadConfigFileInvalidConfigFile()
        {
            //Give
            var configFileReader = new ConfigFileReader();

            //Then
            Assert.Throws <InvalidDataException>(() => configFileReader.ReadConfigFile(_invalidConfigFilePath));
        }
Пример #2
0
        public void ReadConfigFileNonexistingFile()
        {
            //Give
            var configFileReader = new ConfigFileReader();

            //Then
            Assert.Throws <FileNotFoundException>(() => configFileReader.ReadConfigFile(_nonexistingConfigFilePath));
        }
 /// <summary>
 /// Gets the connection string.
 /// </summary>
 /// <param name="region">The region.</param>
 private void GetConnectionString(string region)
 {
     var fileReader = new ConfigFileReader();
     var serverDetails = fileReader.ReadConfigFile
         (new ServerDetailsModel
              {
                  Region = region
              });
     WebConfigPath = serverDetails.ServerList.FirstOrDefault().DeployDirectory + "\\Web.config";
 }
        /// <summary>
        /// Gets the connection string.
        /// </summary>
        /// <param name="region">The region.</param>
        private void GetConnectionString(string region)
        {
            var fileReader    = new ConfigFileReader();
            var serverDetails = fileReader.ReadConfigFile
                                    (new ServerDetailsModel
            {
                Region = region
            });

            WebConfigPath = serverDetails.ServerList.FirstOrDefault().DeployDirectory + "\\Web.config";
        }
Пример #5
0
        /// <summary>
        /// Selects the source and destination.
        /// </summary>
        /// <param name="promoteCode">The promote code.</param>
        private static string SelectSourceAndDestination(PromoteCodeModel promoteCode)
        {
            var configFileReader = new ConfigFileReader();

            ServerDetailsModel serverDetails = configFileReader.ReadConfigFile(new ServerDetailsModel
            {
                Region = promoteCode.Region
            });

            var sourceFileName = serverDetails.SourceFileLocation + "\\" + promoteCode.FileName;

            return(sourceFileName);
        }
Пример #6
0
        /// <summary>
        /// Selects the source and destination.
        /// </summary>
        /// <param name="promoteCode">The promote code.</param>
        private static string SelectSourceAndDestination(PromoteCodeModel promoteCode)
        {
            var configFileReader = new ConfigFileReader();

            ServerDetailsModel serverDetails = configFileReader.ReadConfigFile(new ServerDetailsModel
                                                {
                                                    Region = promoteCode.Region
                                                });

            var sourceFileName = serverDetails.SourceFileLocation + "\\" + promoteCode.FileName;

            return sourceFileName;
        }
Пример #7
0
        /// <summary>
        /// Excecutes the specified deploy entity.
        /// </summary>
        /// <param name="deployEntity">The deploy entity.</param>S
        public void Excecute(dynamic deployEntity)
        {
            var promoteCodeModel = (PromoteCodeModel) deployEntity;

            //initialize config file reader
            var configFileReader = new ConfigFileReader();

            //read config file based on region givenS
            ServerDetailsModel serverDetails = configFileReader.ReadConfigFile(new ServerDetailsModel
            {
                Region = promoteCodeModel.Region
            });

            //get the source file name by concatenating sourcelocation and filename
            serverDetails.SourceFileName = serverDetails.SourceFileLocation + "\\" + promoteCodeModel.FileName;

            //create the destination directory if uit does now exists
            if (!Directory.Exists(serverDetails.DestinationFileLocation))
                Directory.CreateDirectory(serverDetails.DestinationFileLocation);
        }
Пример #8
0
        /// <summary>
        /// Excecutes the specified deploy entity.
        /// </summary>
        /// <param name="deployEntity">The deploy entity.</param>S
        public void Excecute(dynamic deployEntity)
        {
            var promoteCodeModel = (PromoteCodeModel)deployEntity;

            //initialize config file reader
            var configFileReader = new ConfigFileReader();

            //read config file based on region givenS
            ServerDetailsModel serverDetails = configFileReader.ReadConfigFile(new ServerDetailsModel
            {
                Region = promoteCodeModel.Region
            });

            //get the source file name by concatenating sourcelocation and filename
            serverDetails.SourceFileName = serverDetails.SourceFileLocation + "\\" + promoteCodeModel.FileName;

            //create the destination directory if uit does now exists
            if (!Directory.Exists(serverDetails.DestinationFileLocation))
            {
                Directory.CreateDirectory(serverDetails.DestinationFileLocation);
            }
        }
Пример #9
0
        public void ReadConfigFileDefault()
        {
            //Give
            var configFileReader = new ConfigFileReader();
            var expectedResult   = new PlayerConfig
            {
                ServerHostname = "localhost",
                ServerPort     = 4200,
                AskLevel       = 10,
                RespondLevel   = 8,
                TeamNumber     = 1,
                IsLeader       = false,
                Timeout        = 10000,
                GameName       = "Default"
            };

            //When
            var result = configFileReader.ReadConfigFile(String.Empty);

            //Then
            Assert.That(result, Is.EqualTo(expectedResult));
        }