Example #1
0
 public void TestBaseICalendarObject()
 {
     var baseDir = (Environment.OSVersion.Platform == PlatformID.Win32NT) ? System.Environment.GetEnvironmentVariable("UserProfile") : System.Environment.GetEnvironmentVariable("Home");
     var testFileName = "test.ics";
     var dirSepChar = Path.DirectorySeparatorChar;
     var fullFileName = baseDir + dirSepChar.ToString () + testFileName;
     if (File.Exists (fullFileName)) {
         File.Delete (fullFileName);
     }
     var u = "CaliphEvent1";
     var st = new DateTime (2013, 2, 8, 12, 00, 00);
     var et = new DateTime (2013, 2, 8, 13, 00, 00);
     var allDayEvent = true;
     var cn = new Caliph.organizer ("Onorio Catenacci", u);
     var s = "This is a test summary";
     var d = "This is a test description";
     var loc = "This is a test location";
     var e = new Caliph.iCalEvent (st, et, allDayEvent, u, cn, s, loc, d);
     var l = new List<Caliph.ICalendarObject> ();
     l.Add (e);
     var c = new Caliph.core (l);
     var r = c.WriteICal (baseDir, testFileName, true);
     Assert.IsTrue (File.Exists (fullFileName));
     Assert.AreEqual (r, Caliph.cSuccess);
 }
Example #2
0
 public void AttemptingToWriteToABadDirectoryShouldReturnAnIndicationOfFailure()
 {
     var baseDir = @"c:\DoesNotExist";
     var testFileName = "test.ics";
     var dirSepChar = Path.DirectorySeparatorChar;
     var fullFileName = baseDir + dirSepChar.ToString () + testFileName;
     if (File.Exists (fullFileName)) {
         File.Delete (fullFileName);
     }
     var u = "CaliphEvent1";
     var st = new DateTime (2013, 2, 8, 12, 00, 00);
     var et = new DateTime (2013, 2, 8, 13, 00, 00);
     var allDayEvent = true;
     var cn = new Caliph.organizer ("Onorio Catenacci", u);
     var s = "This is a test summary";
     var d = "This is a test description";
     var loc = "This is a test location";
     var e = new Caliph.iCalEvent(st, et, allDayEvent, u, cn, s, loc, d);
     var l = new List<Caliph.ICalendarObject> ();
     l.Add (e);
     var c = new Caliph.core (l);
     var r = c.WriteICal (baseDir, testFileName, true);
     Assert.AreEqual (r, Caliph.cCannotWriteFile);
 }