static private void AddUser() { TopicDTO topic = new TopicDTO(); topic.UsersID = currentUser.IDUser; Console.Write("Please enter Title: "); topic.Title = Console.ReadLine().ToString(); Console.Write("Please enter Text:"); topic.Text = Console.ReadLine().ToString(); CommentDTO comment = new CommentDTO(); Console.Write("Please enter Comment:"); comment.CommentText = Console.ReadLine().ToString(); comment.UsersID = currentUser.IDUser; comment.CommentTime = DateTime.Now; commentDal.Add(comment); var comms = commentDal.Find(comment.CommentText); if (comms.Count == 0) { Console.WriteLine("error!"); } else { topic.CommentID = comms[0].ID; Console.WriteLine(topic.CommentID.ToString()); topicDal.Add(topic); } }
public void AddTopic() { TopicDal a = new TopicDal(connectionString); TopicDTO top = new TopicDTO(); top.ID = -1; top.Title = "Title"; top.Text = "text"; top.CommentID = 99999999; var res = a.Add(top); Assert.IsTrue(res.ID == -1); }