public void DataControllerTestDelete() { using (RDataController controller = new RDataController()) { var contacts = controller.GetDocuments <Contact>(); foreach (var c in contacts) { controller.DeleteDocument(c); } } }
public void DataControllerTestUpdate() { using (RDataController controller = new RDataController()) { var contact = controller.GetDocuments <Contact>().FirstOrDefault(); Trace.WriteLine("New Contact's current name is: " + contact.Name); contact.Name = "Wolfgang Amadeus Mozart"; controller.UpdateDocument(contact); Trace.WriteLine("New Contact's new name is: " + contact.Name); } }
public void DataControllerTestRead() { using (RDataController controller = new RDataController()) { // READ var contacts = controller.GetDocuments <Contact>(); foreach (var c in contacts) { Trace.WriteLine("{0} is {1} years old today.".Replace("{0}", c.Name).Replace("{1}", c.Age.ToString())); } } }
public void DataControllerTestCreate() { var contact = new Contact() { Name = "Wolfgang Mozart", Email = "*****@*****.**", Age = 257 }; using (RDataController controller = new RDataController()) { Trace.WriteLine("New Contact document id: " + contact.Id); controller.AddDocument(contact); Trace.WriteLine("New Contact document id: " + contact.Id); contact.Name = "Bach"; } }