public void Can_GetForMaster_WithId()
        {
            using (var ctx = EFTestData.GetPersistentAbsenceManagentContext()) {
                // Arrange
                var sut    = new EFDisconnectedRelationRepository(ctx);
                var master = ctx.People.FirstOrDefault(p => p.DataSourceId.Equals("30031984"));

                // Act
                var relations = sut.GetForMaster(master.Id);

                // Assert
                Assert.Equal(ctx.Relations.Count(), relations.Count());
            }
        }
        public void Can_GetForSlave_WithId()
        {
            using (var ctx = EFTestData.GetPersistentAbsenceManagentContext()) {
                // Arrange
                var sut   = new EFDisconnectedRelationRepository(ctx);
                var slave = ctx.People.FirstOrDefault(p => p.DataSourceId.Equals("11101985"));

                // Act
                var relations = sut.GetForSlave(slave.Id);

                // Assert
                Assert.Equal(1, relations.Count());
            }
        }
        public void Can_GetById()
        {
            using (var ctx = EFTestData.GetPersistentAbsenceManagentContext()) {
                // Arrange
                var sut    = new EFDisconnectedPersonRepository(ctx);
                var userId = sut.GetAll().FirstOrDefault().Id;

                // Act
                var user = sut.GetById(userId);

                // Assert
                Assert.NotNull(user);
                Assert.Equal(userId, user.Id);
            }
        }
        public void Can_Delete_WithId()
        {
            using (var ctx = EFTestData.GetPersistentAbsenceManagentContext()) {
                // Arrange
                var sut    = new EFDisconnectedPersonRepository(ctx);
                var userId = sut.GetAll().FirstOrDefault().Id;

                // Act
                sut.Delete(userId);
                var user = ctx.People.FirstOrDefault(p => p.Id.Equals(userId));

                // Assert
                Assert.Null(user);
            }
        }
        public void Can_Update()
        {
            using (var ctx = EFTestData.GetPersistentAbsenceManagentContext()) {
                // Arrange
                var sut    = new EFDisconnectedPersonRepository(ctx);
                var userId = sut.GetAll().FirstOrDefault().Id;

                // Act
                var actual = PersonBuilder.CreatePerson("Johnnie", "Doe").Build();
                TestData.SetPrivateProperty(actual, nameof(Person.Id), userId);
                sut.Update(actual);

                // Assert
                Assert.Equal(ctx.People.Count(), sut.GetAll().Count());
                Assert.NotNull(actual);
                Assert.Equal("Johnnie", actual.FirstName);
                Assert.Equal("Doe", actual.LastName);
            }
        }