public void CreateNoteTest() { DateTime now = DateTime.Now; Note n = new Note(){ Text = "This is a test", Date = now }; Assert.AreEqual("This is a test", n.Text); Assert.AreEqual(now, n.Date); }
public ActionResult Create(Note note) { try { dal.CreateNote(note); return RedirectToAction("Index"); } catch { return View(); } }
// Create a Note and insert it into the collection in MongoDB. public void CreateNote(Note note) { MongoCollection<Note> collection = getNotesCollectionForEdit(); try { collection.Insert(note, SafeMode.True); } catch (MongoCommandException ex) { string message = ex.Message; } }
public void DateAutomaticallyGeneratedTest() { Note n = new Note(); Assert.AreNotEqual(DateTime.MinValue, n.Date); }