public void GettingConfigSectionFromExecutableSucceeds()
        {
            // Arrange
            Mock.SetupStatic(typeof(File));
            Mock.Arrange(() => File.Exists(Arg.Is<string>(exePath)))
                .Returns(true)
                .MustBeCalled();

            var configurationSection = new AppclusiveCredentialSection();
            var configuration = Mock.Create<Configuration>();
            Mock.Arrange(() => configuration.GetSection(Arg.IsAny<string>()))
                .IgnoreInstance()
                .Returns(configurationSection)
                .MustBeCalled();

            Mock.SetupStatic(typeof(ConfigurationManager));
            Mock.Arrange(() => ConfigurationManager.OpenExeConfiguration(Arg.Is<string>(exePath)))
                .Returns(configuration)
                .MustBeCalled();

            var sut = new ConfigSectionManager(exePath);

            // Act
            var result = sut.Get(sectionName);

            // Assert
            Mock.Assert(() => ConfigurationManager.OpenExeConfiguration(Arg.Is<string>(exePath)));
            Mock.Assert(() => File.Exists(Arg.Is<string>(exePath)));
            Mock.Assert(configuration);

            Assert.IsInstanceOfType(result, typeof(AppclusiveCredentialSection));
            var appclusiveCredentialSection = result as AppclusiveCredentialSection;
            Assert.IsNotNull(appclusiveCredentialSection);
        }
        public void EncryptingAndDecryptingConfigSectionSucceeds()
        {
            // Arrange
            var sut = new ConfigSectionManager(exePath);

            // Act
            sut.Encrypt(sectionName);

            // Assert
            sut.Decrypt(sectionName);
        }
        public void EncryptingAndGettingEncryptedConfigSectionSucceeds()
        {
            // Arrange
            var sut = new ConfigSectionManager(exePath);

            // Act
            sut.Encrypt(sectionName);
            var result = sut.Get(sectionName);
            sut.Decrypt(sectionName);

            // Assert
            Assert.IsInstanceOfType(result, typeof(AppclusiveCredentialSection));
            var appclusiveCredentialSection = result as AppclusiveCredentialSection;
            Assert.IsNotNull(appclusiveCredentialSection);
            Assert.IsFalse(string.IsNullOrWhiteSpace(appclusiveCredentialSection.Domain));
        }