示例#1
0
        public async Task Test()
        {
            var client = new FakeItemClient();

            client._dict["ModifyInPlace"] = new Item
            {
                Value = 123
            };

            IHost host = new HostBuilder()
                         .ConfigureDefaultTestHost <Functions>(b =>
            {
                b.AddExtension(client);
            })
                         .Build();

            // With out parameter
            client._dict["SetToNull"] = new Item(); // should get ovewritten with null
            await host.GetJobHost().CallAsync(typeof(Functions).GetMethod(nameof(Functions.SetToNull)));

            var item = (Item)client._dict["SetToNull"];

            Assert.Equal(null, item);

            // Modifying in-place
            await host.GetJobHost().CallAsync(typeof(Functions).GetMethod(nameof(Functions.ModifyInPlace)));

            item = (Item)client._dict["ModifyInPlace"];
            Assert.Equal(124, item.Value);
        }
        public void Test()
        {
            var nr = new DictNameResolver();

            nr.Add("appsetting1", "val1");

            var client = new FakeItemClient();

            client._dict["ModifyInPlace"] = new Item
            {
                value = 123
            };

            var host = TestHelpers.NewJobHost <Functions>(nr, client);

            // With out parameter
            {
                client._dict["SetToNull"] = new Item(); // should get ovewritten with null

                host.Call("SetToNull");

                var item = (Item)client._dict["SetToNull"];
                Assert.Equal(null, item);
            }

            // Modifying in-place
            {
                host.Call("ModifyInPlace");

                var item = (Item)client._dict["ModifyInPlace"];
                Assert.Equal(124, item.value);
            }
        }
示例#3
0
 public MySpecialValueBinder(FakeItemClient arg, string index)
 {
     _client = arg;
     _index  = index;
 }