public void IntValue_should_throw_an_InvalidCastExpression_if_the_value_is_not_an_integer()
        {
            var    path   = RegistryPath.CreateValuePath(RegistryHive.Users, "Path", "Value", "s");
            Action action = () => { int unused = path.IntValue; };

            action.Should().ThrowExactly <InvalidCastException>();
        }
        public void StringValue_should_throw_an_InvalidCastExpression_if_the_value_is_not_a_string()
        {
            var    path   = RegistryPath.CreateValuePath(RegistryHive.Users, "Path", "Value", 123);
            Action action = () => { string unused = path.StringValue; };

            action.Should().ThrowExactly <InvalidCastException>();
        }
 public void Parse_should_recognize_an_integer_value()
 {
     RegistryPath.Parse(@"HKEY_DYN_DATA\SubKey\IntValue=123")
     .Should()
     .BeEquivalentTo(
         RegistryPath.CreateValuePath(RegistryHive.DynData, "SubKey", "IntValue", 123),
         GetEquivalenceOptions);
 }
        public void Parse_should_recognize_a_string_value()
        {
            RegistryPath.Parse(@"HKCR\SubKey\StringValue=""s""")
            .Should()
            .BeEquivalentTo(
                RegistryPath.CreateValuePath(RegistryHive.ClassesRoot, "SubKey", "StringValue", "s"),
                GetEquivalenceOptions);

            RegistryPath.Parse(@"HKEY_PERFORMANCE_DATA\SubKey\StringValue='s'")
            .Should()
            .BeEquivalentTo(
                RegistryPath.CreateValuePath(RegistryHive.PerformanceData, "SubKey", "StringValue", "s"),
                GetEquivalenceOptions);
        }
 public void StringValue_should_return_an_integer_if_originally_specified()
 {
     RegistryPath.CreateValuePath(RegistryHive.Users, "Path", "Value", "s").StringValue.Should().Be("s");
 }
 public void IntValue_should_return_an_integer_if_originally_specified()
 {
     RegistryPath.CreateValuePath(RegistryHive.Users, "Path", "Value", 123).IntValue.Should().Be(123);
 }
 public void HasValue_should_be_true_if_there_is_a_value()
 {
     RegistryPath.CreateValuePath(RegistryHive.Users, "Path", "Value", 123).HasValue.Should().BeTrue();
 }