public void EncryptedAppSettingTestReadNexusEncryptedValueTest()
 {
     var test = new EncryptedAppSettingTest();
     string location = Assembly.GetExecutingAssembly().Location;
     test.Path = Path.GetDirectoryName(location);
     test.Filename = string.Format("{0}.config", Path.GetFileName(location));
     test.Key = "NexusEncryptedHello";
     test.ExpectedValue = "World";
     test.Run();
 }
 public void EncryptedAppSettingTestFileNotFoundTest()
 {
     var test = new EncryptedAppSettingTest();
     string location = Assembly.GetExecutingAssembly().Location;
     test.Path = Path.GetDirectoryName(location);
     test.Filename = string.Format("{0}.confug", Path.GetFileName(location));
     test.Key = "NexusEncryptedHello";
     test.ExpectedValue = "Everybody";
     try
     {
         test.Run();
         throw new AssertFailedException("Expected exception was not thrown");
     }
     catch (AssertionException ex)
     {
         Assert.IsTrue(ex.Message.StartsWith("File Not Found"));
     }
 }
 public void EncryptedAppSettingTestNoValueTest()
 {
     var test = new EncryptedAppSettingTest();
     string location = Assembly.GetExecutingAssembly().Location;
     test.Path = Path.GetDirectoryName(location);
     test.Filename = string.Format("{0}.config", Path.GetFileName(location));
     test.Key = "Hallo";
     test.ExpectedValue = "World";
     try
     {
         test.Run();
         throw new AssertFailedException("Expected exception was not thrown");
     }
     catch (AssertionException ex)
     {
         Assert.AreEqual("AppSetting with Key [Hallo] was not found", ex.Message);
     }
 }
        public void EncryptedAppSettingTestNoMatchTest()
        {
            var test = new EncryptedAppSettingTest();
            string location = Assembly.GetExecutingAssembly().Location;
            test.Path = Path.GetDirectoryName(location);
            test.Filename = string.Format("{0}.config", Path.GetFileName(location));

            test.Key = "NexusEncryptedHello";
            test.ExpectedValue = "Everybody";
            try
            {
                test.Run();
                throw new AssertFailedException("Expected exception was not thrown");
            }
            catch (AssertionException<string> ex)
            {
                Assert.AreEqual("Expected [Everybody] Actual [World]", ex.Message);
            }
        }
 public void GivenCreateExampleMethodOneExampleIsCreatedWithTestNameExampleEncryptedAppSettingTest()
 {
     var test = new EncryptedAppSettingTest();
     var result = test.CreateExamples();
     Assert.AreEqual("Example Encrypted AppSetting Test", result.First().TestName);
 } 
 public void GivenCreateExampleMethodOneExampleIsCreated()
 {
     var test = new EncryptedAppSettingTest();
     var result = test.CreateExamples();
     Assert.AreEqual(1, result.Count);
 }
 public void EncryptedAppSettingTestEmptyFileTest()
 {
     var test = new EncryptedAppSettingTest();
     string location = Assembly.GetExecutingAssembly().Location;
     test.Path = Path.GetDirectoryName(location);
     test.Filename = "EmptyFileTest.exe.config";
     test.Key = "NexusEncryptedHello";
     test.ExpectedValue = "Everybody";
     try
     {
         test.Run();
         throw new AssertFailedException("Expected exception was not thrown");
     }
     catch (ConfigurationErrorsException ex)
     {
         Assert.IsTrue(ex.Message.StartsWith("Root element is missing."));
     }
 }