public void RemoveMember()
 {
     try
     {
         var options = CreateNewContextOptions();
         using (var db = new ConversationContext(options))
         {
             ConversationTestHelper.PopulateDefaultDataCtx(db);
         }
         using (var db = new ConversationContext(options))
         {
             var repository = new ConversationRepository(db);
             var item       = GenerateModel();
             var member     = new User {
                 Id = 1
             };
             Assert.DoesNotThrow(() => repository.Save(item));
             Assert.DoesNotThrow(() => repository.AddMember(member, item));
             Assert.DoesNotThrow(() => repository.RemoveMember(member, item));
         }
     }
     catch (Exception ex)
     {
         LogEventManager.Logger.Error(ex);
         throw;
     }
 }
 public void GetMembers2()
 {
     try
     {
         var options = CreateNewContextOptions();
         using (var db = new ConversationContext(options))
         {
             ConversationTestHelper.PopulateDefaultDataCtx(db);
         }
         using (var db = new ConversationContext(options))
         {
             var repository = new ConversationRepository(db);
             var item       = GenerateModel();
             var member     = new User {
                 Id = 1
             };
             IEnumerable <User> result = null;
             Assert.DoesNotThrow(() => repository.Save(item));
             Assert.DoesNotThrow(() => repository.AddMember(member, item));
             Assert.DoesNotThrow(() => result = repository.GetMembers(item.Id));
             Assert.True(result != null && result.Any());
         }
     }
     catch (Exception ex)
     {
         LogEventManager.Logger.Error(ex);
         throw;
     }
 }
 public void Get()
 {
     try
     {
         var options = CreateNewContextOptions();
         using (var db = new ConversationContext(options))
         {
             ConversationTestHelper.PopulateDefaultDataCtx(db);
         }
         using (var db = new ConversationContext(options))
         {
             var repository            = new ConversationRepository(db);
             var item                  = GenerateModel();
             IEnumerable <Conv> result = null;
             Assert.DoesNotThrow(() => repository.Save(item));
             Assert.DoesNotThrow(() => repository.AddMember(new User {
                 Id = 1
             }, item));
             var filter = new ConversationFilter <int>
             {
                 UserId             = item.UserStartedId,
                 ConversationTypeId = item.ConversationTypeId,
             };
             Assert.DoesNotThrow(() => result = repository.Get(filter));
             Assert.True(result != null && result.Any());
             filter.Code = "Conv1";
             Assert.DoesNotThrow(() => result = repository.Get(filter));
             Assert.True(result != null && result.Any());
             filter.Title = "Conversation";
             Assert.DoesNotThrow(() => result = repository.Get(filter));
             Assert.True(result != null && result.Any());
             filter.DateCreatedInterval = new Interval <DateTime?>
             {
                 Start = DateTime.Now.AddDays(-2)
             };
             Assert.DoesNotThrow(() => result = repository.Get(filter));
             Assert.True(result != null && result.Any());
             filter.DateCreatedInterval.Start = null;
             filter.DateCreatedInterval.End   = DateTime.Now.AddDays(2);
             Assert.DoesNotThrow(() => result = repository.Get(filter));
             Assert.True(result != null && result.Any());
             filter.DateCreatedInterval.Start = DateTime.Now.AddDays(-2);
             Assert.DoesNotThrow(() => result = repository.Get(filter));
             Assert.True(result != null && result.Any());
         }
     }
     catch (Exception ex)
     {
         LogEventManager.Logger.Error(ex);
         throw;
     }
 }