public void ReadConfigFileInvalidConfigFile() { //Give var configFileReader = new ConfigFileReader(); //Then Assert.Throws <InvalidDataException>(() => configFileReader.ReadConfigFile(_invalidConfigFilePath)); }
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"; }
/// <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); }
/// <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; }
/// <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); }
/// <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); } }
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)); }