public async Task GetChildrenForOrganization(
            string[] include,
            bool includeFamily,
            bool includeDeterminations
            )
        {
            Guid[] ids;
            int    organizationId;

            using (var context = new TestHedwigContextProvider().Context)
            {
                var organization = OrganizationHelper.CreateOrganization(context);
                var children     = ChildHelper.CreateChildren(context, 3, organization: organization);
                ids            = children.Select(c => c.Id).ToArray();
                organizationId = organization.Id;
            }

            using (var context = new TestHedwigContextProvider().Context)
            {
                var childRepo = new ChildRepository(context);
                var res       = await childRepo.GetChildrenForOrganizationAsync(organizationId, include);

                Assert.Equal(ids.OrderBy(id => id), res.Select(c => c.Id).OrderBy(id => id));
                Assert.Equal(includeFamily, res.TrueForAll(c => c.Family != null));
                Assert.Equal(includeDeterminations, res.TrueForAll(c => c.Family != null && c.Family.Determinations != null));
            }
        }
Example #2
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                if (mLayout != null)
                {
                    mLayout.StopScroll(false);
                    mLayout.ClearRecyclerView();
                    mLayout = null;
                }

                if (mAdapter != null)
                {
                    mAdapter.ItemEvent -= OnItemEvent;
                }

                if (mPanGestureDetector != null)
                {
                    mPanGestureDetector.Detected -= OnPanGestureDetected;
                    mPanGestureDetector.Dispose();
                    mPanGestureDetector = null;
                }

                if (mScrollBarShowTimer != null)
                {
                    mScrollBarShowTimer.Tick -= OnShowTimerTick;
                    mScrollBarShowTimer.Stop();
                    mScrollBarShowTimer.Dispose();
                    mScrollBarShowTimer = null;
                }

                if (mRecyclerPool != null)
                {
                    mRecyclerPool.Clear();
                    mRecyclerPool = null;
                }

                if (mChildHelper != null)
                {
                    mChildHelper.Clear();
                    mChildHelper.Dispose();
                    mChildHelper = null;
                }
            }
            base.Dispose(type);
        }
Example #3
0
        protected override void Dispose(DisposeTypes type)
        {
            if (disposed)
            {
                return;
            }

            if (type == DisposeTypes.Explicit)
            {
                if (layout != null)
                {
                    layout.StopScroll(false);
                    layout.ClearRecyclerView();
                    layout = null;
                }

                if (adapter != null)
                {
                    adapter.ItemEvent -= OnItemEvent;
                }

                if (panGestureDetector != null)
                {
                    panGestureDetector.Detected -= OnPanGestureDetected;
                    panGestureDetector.Dispose();
                    panGestureDetector = null;
                }

                if (scrollBarShowTimer != null)
                {
                    scrollBarShowTimer.Tick -= OnShowTimerTick;
                    scrollBarShowTimer.Stop();
                    scrollBarShowTimer.Dispose();
                    scrollBarShowTimer = null;
                }

                if (recyclerPool != null)
                {
                    recyclerPool.Clear();
                    recyclerPool = null;
                }

                if (childHelper != null)
                {
                    childHelper.Clear();
                    childHelper.Dispose();
                    childHelper = null;
                }
            }
            base.Dispose(type);
        }
        public void GetChildById_ReturnsChild()
        {
            using (var context = new TestHedwigContextProvider().Context)
            {
                // If a child exists
                string name  = "First";
                var    child = ChildHelper.CreateChild(context, name);

                // When the repository is queried for the child:
                var childRepo = new ChildRepository(context);
                var res       = childRepo.GetChildById(child.Id);

                // Then
                Assert.Equal(name, res.FirstName);
            }
        }
Example #5
0
        public FlexibleView()
        {
            mRecyclerPool = new RecycledViewPool(this);

            mRecycler = new FlexibleViewRecycler(this);
            mRecycler.SetRecycledViewPool(mRecyclerPool);

            mChildHelper = new ChildHelper(this);

            mPanGestureDetector = new PanGestureDetector();
            mPanGestureDetector.Attach(this);
            mPanGestureDetector.Detected += OnPanGestureDetected;

            mAdapteHelper = new AdapterHelper(this);

            ClippingMode = ClippingModeType.ClipToBoundingBox;
        }
Example #6
0
        public async Task GetChildForOrganization(
            bool includeFamily,
            bool includeDeterminations
            )
        {
            Child child;

            using (var context = new TestHedwigContextProvider().Context)
            {
                child = ChildHelper.CreateChild(context);
            }
            using (var context = new TestHedwigContextProvider().Context)
            {
                var childRepo = new ChildRepository(context);
                var res       = await childRepo.GetChildForOrganizationAsync(child.Id, child.OrganizationId);

                Assert.Equal(child.Id, res.Id);
                Assert.Equal(includeFamily, res.Family != null);
                Assert.Equal(includeDeterminations, res.Family != null && res.Family.Determinations != null);
            }
        }
        private void InsertMenuItems(Window window)
        {
            #region Menu item initialization
            // Edit menu items.
            editMapMenuItem = new MenuItem()
            {
                Header = "Map"
            };

            editMetaObjectsMenuItem = new MenuItem()
            {
                Header = "Metadata objects"
            };

            // Add menu items.
            addLayerMenuItem = new MenuItem()
            {
                Header = "Layer"
            };

            addLayerMenuItem.Click += addLayerMenuItem_Click;

            addTilesetMenuItem = new MenuItem()
            {
                Header = "Tileset"
            };

            addTilesetMenuItem.Click += addTilesetMenuItem_Click;

            addTileAnimationMenuItem = new MenuItem()
            {
                Header = "Tile animation"
            };

            addMetadataObjectSetMenuItem = new MenuItem()
            {
                Header = "Metadata object set"
            };

            viewLayersMenuItem = new MenuItem()
            {
                Header = "Layers"
            };

            viewLayersMenuItem.Click += viewLayersMenuItem_Click;

            viewTilesetsMenuItem = new MenuItem()
            {
                Header = "Tilesets"
            };

            viewTilesetsMenuItem.Click += viewTilesetsMenuItem_Click;

            resizeLayerMenuItem = new MenuItem()
            {
                Header = "Resize layer"
            };

            resizeLayerMenuItem.Click += resizeLayerMenuItem_Click;

            editMenuSeparator = new Separator();
            #endregion

            // Get root.
            Grid root = LogicalTreeHelper.FindLogicalNode(window, "root") as Grid;

            // Get menu.
            Menu menu = ChildHelper.FindChild <Menu>(root, "menu");

            // Insert new menu items.
            editMenuItem = ChildHelper.FindMenuItem(menu, "editMenuItem");

            editMenuItem.Items.Add(editMenuSeparator);
            editMenuItem.Items.Add(editMapMenuItem);
            editMenuItem.Items.Add(editMetaObjectsMenuItem);
            editMenuItem.Items.Add(resizeLayerMenuItem);

            // Insert new menu items.
            addMenuItem = ChildHelper.FindMenuItem(menu, "addMenuItem");

            addMenuItem.Items.Add(addLayerMenuItem);
            addMenuItem.Items.Add(addTilesetMenuItem);
            addMenuItem.Items.Add(addTileAnimationMenuItem);
            addMenuItem.Items.Add(addMetadataObjectSetMenuItem);

            // Insert new menu items.
            viewMenuItem    = ChildHelper.FindMenuItem(menu, "viewMenuItem");
            windowsMenuItem = ChildHelper.FindMenuItem(viewMenuItem.Items, "windowsMenuItem");

            windowsMenuItem.Items.Add(viewLayersMenuItem);
        }