Example #1
0
        //Ensures mapping from registry values to dto
        public void CanGetObject()
        {
            TestDto sutResult = RegistryMapper <TestDto> .Get();

            Assert.IsNotNull(sutResult);
            Assert.IsTrue(sutResult.Prop1 == "Test1");
            Assert.IsTrue(sutResult.Prop2 == "Test2");
        }
Example #2
0
        //Ensures boolean conversions in get
        public void CanGetAndConvertBoolToEnabledDisabled()
        {
            TestDtoBoolConversions sutResult = RegistryMapper <TestDtoBoolConversions> .Get();

            Assert.IsNotNull(sutResult);
            Assert.IsTrue(!sutResult.BoolEnabledDisabled);
            Assert.IsTrue(sutResult.BoolBit);
        }
Example #3
0
        //Ensures boolean conversions in set
        public void CanSetAndConvertBoolToEnabledDisabled()
        {
            var testDto = new TestDtoBoolConversions()
            {
                BoolEnabledDisabled = false,
                BoolBit             = true
            };

            try
            {
                RegistryMapper <TestDtoBoolConversions> .Set(testDto);
            }
            catch (UnauthorizedAccessException)
            {
                Assert.Inconclusive("Please run this test as an administrator as it requries to insert registry values.");
            }

            Assert.IsTrue((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Dev4Side", "BoolEnabledDisabled", null) == "disabled");
            Assert.IsTrue((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Dev4Side", "BitEnabledDisabled", null) == "1");
        }
Example #4
0
        //Ensures mapping from dto values to registry
        public void CanSetObject()
        {
            var testDto = new TestDto
            {
                Prop1 = "TestA",
                Prop2 = "TestB"
            };

            try
            {
                RegistryMapper <TestDto> .Set(testDto);
            }
            catch (UnauthorizedAccessException)
            {
                Assert.Inconclusive("Please run this test as an administrator as it requries to insert registry values.");
            }

            Assert.IsTrue((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Dev4Side", "Prop1", null) == "TestA");
            Assert.IsTrue((string)Registry.GetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Dev4Side\\SubKey", "Prop2", null) == "TestB");
        }