示例#1
0
        public void TestResolvingString(Resolver resolver, string input, string expect)
        {
            Resolver.AddResolver("test", resolver);

            try
            {
                ResolvingString rs     = input;
                string?         result = rs;
                Assert.Equal(expect, result);
            }
            finally
            {
                Resolver.RemoveResolver("test");
            }
        }
        public override void Deserialized(IServiceProvider serviceProvider, Solution solution)
        {
            base.Deserialized(serviceProvider, solution);

            // Parse the path: <rootkey>\<path>\<value>
            string path = this.Path.ToString().Replace('/', '\\');

            string[] parts = path.Split("\\", 2);
            if (parts.Length != 2)
            {
                throw new SolutionsRegistryException($"'{this.Path}' is not a valid registry key path.");
            }

            this.RootKeyName = parts[0];
            this.KeyPath     = parts[1];
        }
示例#3
0
        public void TestResolvingStringIsLive()
        {
            Resolver.AddResolver("test", Resolver1);

            try
            {
                ResolvingString rs = "${test:changing}";

                Resolver1.Values["changing"] = "first value";
                string?result1 = rs;
                Assert.Equal("first value", result1);

                Resolver1.Values["changing"] = "updated value";
                string?result2 = rs;
                Assert.Equal("updated value", result2);
            }
            finally
            {
                Resolver.RemoveResolver("test");
            }
        }