Inheritance: Dev2.Runtime.Security.HostSecureConfig
Exemplo n.º 1
0
        static void TestConfig(Guid expectedServerID, string expectedServerKey, string expectedSystemKey, bool isNewConfig, HostSecureConfigMock config)
        {
            var actualServerID = config.ServerID;

            var actualServerKey   = config.ServerKey;
            var actualServerKey64 = Convert.ToBase64String(actualServerKey.ExportCspBlob(true));

            var actualSystemKey   = config.SystemKey;
            var actualSystemKey64 = Convert.ToBase64String(actualSystemKey.ExportCspBlob(false));

            Assert.IsFalse(actualServerKey.PublicOnly);
            Assert.IsTrue(actualSystemKey.PublicOnly);
            Assert.AreEqual(expectedSystemKey, actualSystemKey64);

            if (isNewConfig)
            {
                Assert.AreNotEqual(expectedServerID, actualServerID);
                Assert.AreNotEqual(expectedServerKey, actualServerKey64);

                Assert.IsNotNull(config.SaveConfigSettings);
                Assert.AreNotEqual(_newSettings, config.SaveConfigSettings);

                Assert.AreEqual(1, config.SaveConfigHitCount);
                Assert.AreEqual(1, config.ProtectConfigHitCount);
            }
            else
            {
                Assert.AreEqual(expectedServerID, actualServerID);
                Assert.AreEqual(expectedServerKey, actualServerKey64);

                Assert.IsNull(config.SaveConfigSettings);

                Assert.AreEqual(0, config.SaveConfigHitCount);
                Assert.AreEqual(0, config.ProtectConfigHitCount);
            }
        }
 static void TestConfig(Guid expectedServerID, string expectedServerKey, string expectedSystemKey, bool isNewConfig)
 {
     var config = new HostSecureConfigMock(isNewConfig ? _newSettings : _defaultSettings);
     TestConfig(expectedServerID, expectedServerKey, expectedSystemKey, isNewConfig, config);
 }
Exemplo n.º 3
0
        static void TestConfig(Guid expectedServerID, string expectedServerKey, string expectedSystemKey, bool isNewConfig)
        {
            var config = new HostSecureConfigMock(isNewConfig ? _newSettings : _defaultSettings);

            TestConfig(expectedServerID, expectedServerKey, expectedSystemKey, isNewConfig, config);
        }
        static void TestConfig(Guid expectedServerID, string expectedServerKey, string expectedSystemKey, bool isNewConfig, HostSecureConfigMock config)
        {
            var actualServerID = config.ServerID;

            var actualServerKey = config.ServerKey;
            var actualServerKey64 = Convert.ToBase64String(actualServerKey.ExportCspBlob(true));

            var actualSystemKey = config.SystemKey;
            var actualSystemKey64 = Convert.ToBase64String(actualSystemKey.ExportCspBlob(false));

            Assert.IsFalse(actualServerKey.PublicOnly);
            Assert.IsTrue(actualSystemKey.PublicOnly);
            Assert.AreEqual(expectedSystemKey, actualSystemKey64);

            if(isNewConfig)
            {
                Assert.AreNotEqual(expectedServerID, actualServerID);
                Assert.AreNotEqual(expectedServerKey, actualServerKey64);

                Assert.IsNotNull(config.SaveConfigSettings);
                Assert.AreNotEqual(_newSettings, config.SaveConfigSettings);

                Assert.AreEqual(1, config.SaveConfigHitCount);
                Assert.AreEqual(1, config.ProtectConfigHitCount);
            }
            else
            {
                Assert.AreEqual(expectedServerID, actualServerID);
                Assert.AreEqual(expectedServerKey, actualServerKey64);

                Assert.IsNull(config.SaveConfigSettings);

                Assert.AreEqual(0, config.SaveConfigHitCount);
                Assert.AreEqual(0, config.ProtectConfigHitCount);
            }
        }