Exemplo n.º 1
0
        private TestEnvironment()
        {
            var config = new FileInfo(@"WebsiteUnderTest\web_test.config.json");
            var json   = File.ReadAllText(config.FullName);

            this.settings = JsonConvert.DeserializeObject <WebTestSettings>(json);
        }
        private TestEnvironment()
        {
            var pathToConfig = @"WebsiteUnderTest\web_test.config.json";
            // If tests are running on NUnit > 3.0, use test directory to find files
            // A null check for this directory doesn't suffice as null checking TestContext.CurrentContext.TestDirectory throws a null reference exception with older versions of NUnit on TeamCity
            try
            {
                pathToConfig = Path.Combine(TestContext.CurrentContext.TestDirectory, pathToConfig);
            }
            catch (NullReferenceException ex)
            {
                Console.WriteLine("TestContext.CurrentContext.TestDirectory not found: " + ex.Message);
            }
            
            var json = File.ReadAllText(new FileInfo(pathToConfig).FullName);

            this.settings = JsonConvert.DeserializeObject<WebTestSettings>(json);
        }
Exemplo n.º 3
0
        private TestEnvironment()
        {
            var pathToConfig = @"WebsiteUnderTest\web_test.config.json";

            // If tests are running on NUnit > 3.0, use test directory to find files
            // A null check for this directory doesn't suffice as null checking TestContext.CurrentContext.TestDirectory throws a null reference exception with older versions of NUnit on TeamCity
            try
            {
                pathToConfig = Path.Combine(TestContext.CurrentContext.TestDirectory, pathToConfig);
            }
            catch (NullReferenceException ex)
            {
                Console.WriteLine("TestContext.CurrentContext.TestDirectory not found: " + ex.Message);
            }

            var json = File.ReadAllText(new FileInfo(pathToConfig).FullName);

            this.settings = JsonConvert.DeserializeObject <WebTestSettings>(json);
        }