//[TestMethod] public void createalogofMessages() { /* * All tests start with a clean file to work against to ensure that no test affects any other. * This method creates the tweets file, removes the following files and creates a clean slate * for the subsequent test. * */ //get rid of the server/file if it exists.. TweetRepository.Deleterepository(); //Set up an array to contain a set of messages TweetMessageWriter tmw = new TweetMessageWriter(); //create those message and add them to the collection tmw.writeMessage(new tweetyMessage("Alice", "I love the weather today")); tmw.writeMessage(new tweetyMessage("Bob", "Damn! We lost!")); tmw.writeMessage(new tweetyMessage("Bob", "Good game though.")); tmw.writeMessage(new tweetyMessage("Charlie", "I'm in New York today! Anyone want to have a coffee?")); tweetMessageReader tmr = new tweetMessageReader(); Trace.WriteLine(tmr.ToString()); }
public void WriteMessageToDb() { createalogofMessages(); tweetyMessage tm = new tweetyMessage("Lance", "This is a test message"); TweetMessageWriter wt = new TweetMessageWriter(tm); try { wt.writeMessage(); Trace.WriteLine("Passed Write Message"); } catch (Exception e) { Assert.Fail(e.Message); } }