Esempio n. 1
0
 public object MarshalNativeToManaged(IntPtr pNativeData)
 {
     if (pNativeData == IntPtr.Zero)
     {
         return(default(DateTime));
     }
     return(ObjC.FromNSDate(pNativeData));
 }
Esempio n. 2
0
    public void FromNSDate()
    {
        //UTC now without the milliseconds
        var date = DateTime.UtcNow;

        date = date.AddMilliseconds(-date.Millisecond);

        IntPtr handle = ObjC.ToNSDate(date);
        var    actual = ObjC.FromNSDate(handle);

        Assert.AreEqual(date.ToShortDateString(), actual.ToShortDateString());
        Assert.AreEqual(date.ToShortTimeString(), actual.ToShortTimeString());
    }
Esempio n. 3
0
    public void FromNSDateNull()
    {
        var date = ObjC.FromNSDate(IntPtr.Zero);

        Assert.AreEqual(default(DateTime), date);
    }