Esempio n. 1
0
        public async Task TestListViewProcessSelectedItem()
        {
            HandlerMock.SetupRestPropertyObject(Application.CreateObjectSpace(typeof(RestPropertyObject)),
                                                o => o.StringArray = new[] { "a" });

            await Application.TestListViewProcessSelectedItem(typeof(RestPropertyObject));
        }
        public async Task ReadOnly_DomainComponent_Dependency()
        {
            HandlerMock.SetupRestPropertyObject(Application.CreateObjectSpace(typeof(RestPropertyObject)));

            var restObject = await Application.CreateObjectSpace(typeof(RestPropertyObject))
                             .Request <RestPropertyObject>();

            restObject.RestObjectStats.ShouldNotBeNull();
            restObject.RestObjectStats.Name.ShouldBe(restObject.RestOperationObjectName);
        }
        public async Task Arrays_BindingList()
        {
            HandlerMock.SetupRestPropertyObject(Application.CreateObjectSpace(typeof(RestPropertyObject)), o => o.StringArray = new [] { "a" });

            var restObject = await Application.CreateObjectSpace(typeof(RestPropertyObject))
                             .Request <RestPropertyObject>();

            restObject.StringArrayList.Count.ShouldBe(1);
            restObject.StringArrayList.First().Name.ShouldBe("a");
        }
        public async Task ReactiveCollection_Fetch()
        {
            HandlerMock.SetupRestPropertyObject(Application.CreateObjectSpace(typeof(RestPropertyObject)));

            var restObject = await Application.CreateObjectSpace(typeof(RestPropertyObject))
                             .Request <RestPropertyObject>();

            var whenListChanged    = restObject.ActiveObjects.WhenListChanged().FirstAsync();
            var activeObjectsCount = restObject.ActiveObjects.Count;

            activeObjectsCount.ShouldBe(0);
            await whenListChanged;

            restObject.ActiveObjects.Count.ShouldBeGreaterThan(activeObjectsCount);
        }
Esempio n. 5
0
        public async Task Cache_Get_Requests(int times)
        {
            var typeInfo           = Application.TypesInfo.FindTypeInfo(typeof(RestPropertyObject));
            var operationAttribute = typeInfo.FindAttributes <RestOperationAttribute>().First(attribute => attribute.Operation == Operation.Get);

            if (times == 2)
            {
                operationAttribute.PollInterval = 0;
            }
            HandlerMock.SetupRestPropertyObject(Application.CreateObjectSpace(typeof(RestPropertyObject)));
            await Application.CreateObjectSpace(typeof(RestPropertyObject))
            .Request(typeof(RestPropertyObject)).FirstAsync().Timeout(Timeout);

            await Application.CreateObjectSpace(typeof(RestPropertyObject))
            .Request(typeof(RestPropertyObject)).Timeout(Timeout);

            HandlerMock.VerifySend(Times.Exactly(times), message => $"{message.RequestUri}".Contains($"Get{nameof(RestPropertyObject)}"));

            operationAttribute.PollInterval = RestOperationAttribute.DefaultPollingInterval;
        }
Esempio n. 6
0
        public async Task Arrays_BindingList_Lookup_Datasource()
        {
            HandlerMock.SetupRestPropertyObject(Application.CreateObjectSpace(typeof(RestPropertyObject)),
                                                o => o.StringArray = new[] { "a" });
            var detailView = await Application.TestListViewProcessSelectedItem(typeof(RestPropertyObject));

            var nestedFrame           = detailView.GetListPropertyEditor <RestPropertyObject>(o => o.StringArrayList).Frame;
            var whenDetailViewCreated =
                Application.WhenDetailViewCreated(typeof(ObjectString)).FirstAsync().SubscribeReplay();
            var newObjectAction = nestedFrame.GetController <NewObjectViewController>().NewObjectAction;

            newObjectAction.DoExecute(
                space => new[] { space.GetObject(nestedFrame.View.AsListView().CollectionSource.Objects().First()) },
                true);

            var t = await whenDetailViewCreated;

            var currentObject      = ((ObjectString)t.e.View.CurrentObject);
            var restPropertyObject = ((RestPropertyObject)detailView.CurrentObject);

            currentObject.DataSource.Count.ShouldBe(restPropertyObject.StringArraySource.Count);
            currentObject.DataSource.Select(s => s.Name).First()
            .ShouldBe(restPropertyObject.StringArraySource.Select(s => s.Name).First());
        }