コード例 #1
0
ファイル: ProxyTest.cs プロジェクト: aL3891/KeyValueProxy
        public void SubSubProperty()
        {
            var store  = new DictionaryKVStore();
            var target = KeyValueProxyFactory.Create <IPerson>(store);

            target.Address.State.PropertyChanged += State_PropertyChanged;

            target.Address.State.Code = "test";
            target.Address.State.Code.Should().Be("test");
            store.Store.Should().Contain("Address.State.Code", "test");
        }
コード例 #2
0
ファイル: ProxyTest.cs プロジェクト: aL3891/KeyValueProxy
        public async Task SubProperty()
        {
            var store  = new DictionaryKVStore();
            var target = KeyValueProxyFactory.Create <IPerson>(store);

            target.Address.Street = "test";
            target.Address.Street.Should().Be("test");

            target.Address.SetPostalCode("test2");
            target.Address.GetPostalCode().Should().Be("test2");

            await target.Address.SetCity("test2");

            (await target.Address.GetCity()).Should().Be("test2");

            store.Store.Should().Contain("Address.Street", "test");
        }
コード例 #3
0
ファイル: ProxyTest.cs プロジェクト: aL3891/KeyValueProxy
        public async Task RegularProperty()
        {
            var store  = new DictionaryKVStore();
            var target = KeyValueProxyFactory.Create <IPerson>(store);

            target.SetFirstName("test");
            target.GetFirstName().Should().Be("test");
            await target.SetLastName("test2");

            (await target.GetLastName()).Should().Be("test2");
            target.Age = 1;
            target.Age.Should().Be(1);

            store.Store.Should().Contain("FirstName", "test");
            store.Store.Should().Contain("LastName", "test2");

            target.PropertyChanged += Target_PropertyChanged;
            target.Age              = 1;
            target.PropertyChanged -= Target_PropertyChanged;
            target.Age              = 1;
            gotEvent.Should().BeTrue();
        }