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 #2
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);
            }
        }