public void AddNewMessagesCompanyIdTest() { CompanyDAL companyDAL = new CompanyDAL(); List <CompanyModel> companies = companyDAL.GetCompanies(); MessagesFromBulidingModel model = new MessagesFromBulidingModel(); model.Subject = "testSubject"; model.Text = "testText"; model.Companies = companies; MessageDAL messageDAL = new MessageDAL(); messageDAL.AddNewMessages(model); List <MessageToCompanyModel> messages = messageDAL.GetMessagesFromBuilding(); int counter = 0; foreach (var item in companies) { if (messages.Where(x => x.Subject == "testSubject" && x.CompanyId == item.Id).FirstOrDefault() != null) { counter++; } } Assert.That(counter == companies.Count, Is.True); }
public void AddNewMessagesSubjectTest() { CompanyDAL companyDAL = new CompanyDAL(); List <CompanyModel> companies = companyDAL.GetCompanies(); MessagesFromBulidingModel model = new MessagesFromBulidingModel(); model.Subject = "testSubject"; model.Text = "testText"; model.Companies = companies; MessageDAL messageDAL = new MessageDAL(); messageDAL.AddNewMessages(model); List <MessageToCompanyModel> messages = messageDAL.GetMessagesFromBuilding(); Assert.That(messages.Where(x => x.Subject == "testSubject").Any(), Is.True); }
public void AddNewMessages(MessagesFromBulidingModel model) { MessageDAL messageDAL = new MessageDAL(); messageDAL.AddNewMessages(model); }