Exemplo n.º 1
0
        public void WhenValidDataIsStored_SameDataReadOnLoad()
        {
            this.hkcu.DeleteSubKeyTree(TestKeyPath, false);
            var registryKey = hkcu.CreateSubKey(TestKeyPath);

            var original = new KeyWithData()
            {
                String        = "test",
                Dword         = 42,
                NullableDword = 45,
                Qword         = 99999999999999999L,
                NullableQword = null,
                Bool          = true,
                NullableBool  = true
            };

            new RegistryBinder <KeyWithData>().Store(original, registryKey);

            var copy = new RegistryBinder <KeyWithData>().Load(registryKey);

            Assert.AreEqual(original.String, copy.String);
            Assert.AreEqual(original.Dword, copy.Dword);
            Assert.AreEqual(original.NullableDword, copy.NullableDword);
            Assert.AreEqual(original.Qword, copy.Qword);
            Assert.AreEqual(original.NullableQword, copy.NullableQword);
            Assert.AreEqual(original.Bool, copy.Bool);
            Assert.AreEqual(original.NullableBool, copy.NullableBool);
        }
Exemplo n.º 2
0
        public void WhenNullDataIsStored_SameDataReadOnLoad()
        {
            hkcu.DeleteSubKeyTree(TestKeyPath, false);
            var registryKey = hkcu.CreateSubKey(TestKeyPath);

            var original = new KeyWithData()
            {
                String        = null,
                NullableDword = null
            };

            new RegistryBinder <KeyWithData>().Store(original, registryKey);

            var copy = new RegistryBinder <KeyWithData>().Load(registryKey);

            Assert.AreEqual(original.String, copy.String);
            Assert.AreEqual(original.Dword, copy.Dword);
            Assert.AreEqual(original.NullableDword, copy.NullableDword);
        }