public void GetFamilyById_ReturnsFamilyWithId()
        {
            using (var context = new TestHedwigContextProvider().Context)
            {
                var family = FamilyHelper.CreateFamily(context);

                var familyRepo = new FamilyRepository(context);
                var res        = familyRepo.GetFamilyById(family.Id);

                Assert.Equal(family.Id, res.Id);
            }
        }
Ejemplo n.º 2
0
        public async Task UpdatedTemporalEntity_IsUpdated_OnSaveChangesAsync()
        {
            using (var context = new TestHedwigContextProvider().Context)
            {
                var family    = FamilyHelper.CreateFamily(context);
                var updatedAt = family.UpdatedAt;
                context.Update(family);
                await context.SaveChangesAsync();

                Assert.NotNull(family.AuthorId);
                Assert.NotNull(family.UpdatedAt);
                Assert.NotEqual(updatedAt, family.UpdatedAt);
            }
        }
Ejemplo n.º 3
0
        public void GetDeterminationByFamilyId_ReturnsDeterminationsWithFamilyId()
        {
            using (var context = new TestHedwigContextProvider().Context)
            {
                // If a family determination exist with family Id
                var family        = FamilyHelper.CreateFamily(context);
                var determination = FamilyDeterminationHelper.CreateDetermination(context, family: family);

                // When the repository is queried with a family Id
                var determinationRepo = new FamilyDeterminationRepository(context);
                var res = determinationRepo.GetDeterminationsByFamilyId(family.Id);

                // Then a list including only that determination is returned
                Assert.Single(res);
                Assert.Equal(determination.Id, res.First().Id);
            }
        }