//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"); }
//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"); }