public void GetAllLimited() { NhibernateService.Instance.DeleteAll<DialogMessage>(); NhibernateService.Instance.CreateMultiple(_list); var getMessages = new GetDialogMessages(UserId); var messages = getMessages.GetAllLimited(3); Assert.AreEqual(4, messages.Count()); Assert.IsTrue(messages.All(x => x.VkUserId == UserId)); var lastMessage = messages.OrderByDescending(x => x.Date).First(); Assert.AreEqual(_list[0].VkId, lastMessage.VkId); NhibernateService.Instance.DeleteAll<DialogMessage>(); }
public void LoadFromDB() { var getDialogMessages = new GetDialogMessages(_sessionInfoRepo.UserId); var dialogMessages = getDialogMessages.GetAllLimited().ToList(); _dialogMessagesRepo.Set(dialogMessages, DataSourceType.DB); }