Inheritance: PObject
Esempio n. 1
0
 public PDateTime(PDateTime other) : this(PapillonPINVOKE.new_PDateTime__SWIG_3(PDateTime.getCPtr(other)), true)
 {
     if (PapillonPINVOKE.SWIGPendingException.Pending)
     {
         throw PapillonPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 2
0
 public void SetOccurrenceTime(PDateTime occurrenceTime)
 {
     PapillonPINVOKE.PEvent_SetOccurrenceTime(swigCPtr, PDateTime.getCPtr(occurrenceTime));
     if (PapillonPINVOKE.SWIGPendingException.Pending)
     {
         throw PapillonPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 3
0
 public void SetTimestamp(PDateTime t)
 {
     PapillonPINVOKE.PEntity_SetTimestamp(swigCPtr, PDateTime.getCPtr(t));
     if (PapillonPINVOKE.SWIGPendingException.Pending)
     {
         throw PapillonPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 4
0
 public void SetDetectionTime(PDateTime detectionTime)
 {
     PapillonPINVOKE.PEvent_SetDetectionTime(swigCPtr, PDateTime.getCPtr(detectionTime));
     if (PapillonPINVOKE.SWIGPendingException.Pending)
     {
         throw PapillonPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 5
0
 public void SetTimestampLatestUpdate(PDateTime timestamp)
 {
     PapillonPINVOKE.PStore_SetTimestampLatestUpdate(swigCPtr, PDateTime.getCPtr(timestamp));
     if (PapillonPINVOKE.SWIGPendingException.Pending)
     {
         throw PapillonPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Esempio n. 6
0
    public int Compare(PDateTime other)
    {
        int ret = PapillonPINVOKE.PDateTime_Compare(swigCPtr, PDateTime.getCPtr(other));

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 7
0
    public PEventBuilder DetectionTime(PDateTime detectionTime)
    {
        PEventBuilder ret = new PEventBuilder(PapillonPINVOKE.PEventBuilder_DetectionTime(swigCPtr, PDateTime.getCPtr(detectionTime)), false);

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 8
0
    public long GetMillisecondsTo(PDateTime d)
    {
        long ret = PapillonPINVOKE.PDateTime_GetMillisecondsTo(swigCPtr, PDateTime.getCPtr(d));

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 9
0
        public bool IsTodayHoliday_should_consider_a_set_day_and_the_previous_day_as_holiday(DateTime today, DayOfWeek holiday)
        {
            using (new IndirectionsContext())
            {
                // Arrange
                PDateTime.TodayGet().Body = () => today;
                PULConfigurationManager.GetPropertyOfTStringT <DayOfWeek>().Body = (key, defaultValue) => holiday;

                // Act, Assert
                return(LifeInfo.IsTodayHoliday());
            }
        }
Esempio n. 10
0
        public void IsNowLunchBreak_should_return_false_when_13_oclock()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                PDateTime.NowGet().Body = () => new DateTime(2013, 12, 13, 13, 00, 00);

                // Act
                var result = LifeInfo.IsNowLunchBreak();

                // Assert
                Assert.IsFalse(result);
            }
        }
Esempio n. 11
0
        public void CompareTo_should_be_callable_indirectly()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                PDateTime.CompareToObject().Body = (ref DateTime @this, object value) => ((DateTime)value).CompareTo(new DateTime(2013, 12, 23));

                // Act
                var actual = DateTime.Now.CompareTo((object)new DateTime(2013, 12, 23));

                // Assert
                Assert.AreEqual(0, actual);
            }
        }
Esempio n. 12
0
        public void GetterOfNow_should_be_callable_indirectly()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                PDateTime.NowGet().Body = () => new DateTime(2014, 02, 14, 11, 30, 55, 00);

                // Act
                var actual = DateTime.Now;

                // Assert
                Assert.AreEqual(new DateTime(2014, 02, 14, 11, 30, 55, 00), actual);
            }
        }
Esempio n. 13
0
        public void FromBinary_should_be_callable_indirectly()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                PDateTime.FromBinaryInt64().Body = _ => new DateTime(2014, 12, 23, 01, 02, 03, 00);

                // Act
                var dateData = DateTime.Now.ToBinary();
                var actual   = DateTime.FromBinary(dateData);

                // Assert
                Assert.AreEqual(new DateTime(2014, 12, 23, 01, 02, 03, 00), actual);
            }
        }
Esempio n. 14
0
        public void DoubleDateToTicks_should_be_callable_indirectly()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                PDateTime.DoubleDateToTicksDouble().Body = value => 635233945530440000L;

                // Act
                var oaDate = DateTime.Now.ToOADate();
                var actual = new DateTime(DateTimeMixin.DoubleDateToTicks(oaDate), DateTimeKind.Unspecified);

                // Assert
                Assert.AreEqual(new DateTime(2013, 12, 23, 11, 22, 33, 44), actual);
            }
        }
Esempio n. 15
0
        public void IsNowLunchBreak_should_return_false_when_11_oclock()
        {
            // `IndirectionsContext` can minimize the influence of the API replacement.
            using (new IndirectionsContext())
            {
                // Arrange
                // Replace `DateTime.Now` body. Hereafter, `DateTime.Now` will return only `2013/12/13 11:00:00`.
                PDateTime.NowGet().Body = () => new DateTime(2013, 12, 13, 11, 00, 00);

                // Act
                var result = LifeInfo.IsNowLunchBreak();

                // Assert
                Assert.IsFalse(result);
            }
        }
Esempio n. 16
0
        public void MSCorLib_something_that_is_in_another_AppDomain_should_be_callable_indirectly()
        {
            AppDomain.CurrentDomain.RunAtIsolatedDomain(() =>
            {
                using (new IndirectionsContext())
                {
                    // Arrange
                    PDateTime.NowGet().Body = () => new DateTime(2013, 12, 13, 12, 00, 00);

                    // Act
                    var result = DateTime.Now;

                    // Assert
                    Assert.AreEqual(new DateTime(2013, 12, 13, 12, 00, 00), result);
                }
            });
        }
Esempio n. 17
0
        public void GetterOfNow_should_be_callable_originally_any_time()
        {
            using (new IndirectionsContext())
            {
                // Arrange
                var count = 0;
                PDateTime.NowGet().Body = () =>
                {
                    if (5 <= ++count)
                    {
                        return(new DateTime(2013, 12, 23, 11, 22, 33, 44));
                    }
                    else
                    {
                        return(IndirectionsContext.ExecuteOriginal(() => DateTime.Now));
                    }
                };

                // Act
                var actuals = new List <DateTime>();
                actuals.Add(DateTime.Now);
                actuals.Add(DateTime.Now);
                actuals.Add(DateTime.Now);
                actuals.Add(DateTime.Now);
                actuals.Add(DateTime.Now);
                actuals.Add(DateTime.Now);

                // Assert
                var indirectValue = new DateTime(2013, 12, 23, 11, 22, 33, 44);
                Assert.AreNotEqual(indirectValue, actuals[0]);
                Assert.AreNotEqual(indirectValue, actuals[1]);
                Assert.AreNotEqual(indirectValue, actuals[2]);
                Assert.AreNotEqual(indirectValue, actuals[3]);
                Assert.AreEqual(indirectValue, actuals[4]);
                Assert.AreEqual(indirectValue, actuals[5]);
            }
        }
Esempio n. 18
0
    public PDateTime GetOccurrenceTime()
    {
        PDateTime ret = new PDateTime(PapillonPINVOKE.PEvent_GetOccurrenceTime(swigCPtr), false);

        return(ret);
    }
Esempio n. 19
0
    public static PDateTime CurrentUTC()
    {
        PDateTime ret = new PDateTime(PapillonPINVOKE.PDateTime_CurrentUTC(), true);

        return(ret);
    }
Esempio n. 20
0
    public PDateTime GetTimestampUTC()
    {
        PDateTime ret = new PDateTime(PapillonPINVOKE.PFrame_GetTimestampUTC(swigCPtr), true);

        return(ret);
    }
Esempio n. 21
0
    public PDateTime GetDetectionTime()
    {
        PDateTime ret = new PDateTime(PapillonPINVOKE.PEvent_GetDetectionTime(swigCPtr), false);

        return(ret);
    }
Esempio n. 22
0
    public PDateTime ToUTC()
    {
        PDateTime ret = new PDateTime(PapillonPINVOKE.PDateTime_ToUTC(swigCPtr), true);

        return(ret);
    }
Esempio n. 23
0
    public PDateTime GetTimestampLatestUpdate()
    {
        PDateTime ret = new PDateTime(PapillonPINVOKE.PStore_GetTimestampLatestUpdate(swigCPtr), true);

        return(ret);
    }
Esempio n. 24
0
    public PDateTime GetTimestamp()
    {
        PDateTime ret = new PDateTime(PapillonPINVOKE.PEntity_GetTimestamp(swigCPtr), true);

        return(ret);
    }
Esempio n. 25
0
    public static PDateTime Bad()
    {
        PDateTime ret = new PDateTime(PapillonPINVOKE.PDateTime_Bad(), false);

        return(ret);
    }
Esempio n. 26
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PDateTime obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
Esempio n. 27
0
    public PDateTime AddMillisecond(long n)
    {
        PDateTime ret = new PDateTime(PapillonPINVOKE.PDateTime_AddMillisecond(swigCPtr, n), true);

        return(ret);
    }
Esempio n. 28
0
    public static PDateTime FromMillisecondsSinceEpoch(long n)
    {
        PDateTime ret = new PDateTime(PapillonPINVOKE.PDateTime_FromMillisecondsSinceEpoch(n), true);

        return(ret);
    }