public PDateTime(PDateTime other) : this(PapillonPINVOKE.new_PDateTime__SWIG_3(PDateTime.getCPtr(other)), true) { if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetOccurrenceTime(PDateTime occurrenceTime) { PapillonPINVOKE.PEvent_SetOccurrenceTime(swigCPtr, PDateTime.getCPtr(occurrenceTime)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetTimestamp(PDateTime t) { PapillonPINVOKE.PEntity_SetTimestamp(swigCPtr, PDateTime.getCPtr(t)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetDetectionTime(PDateTime detectionTime) { PapillonPINVOKE.PEvent_SetDetectionTime(swigCPtr, PDateTime.getCPtr(detectionTime)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public void SetTimestampLatestUpdate(PDateTime timestamp) { PapillonPINVOKE.PStore_SetTimestampLatestUpdate(swigCPtr, PDateTime.getCPtr(timestamp)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } }
public int Compare(PDateTime other) { int ret = PapillonPINVOKE.PDateTime_Compare(swigCPtr, PDateTime.getCPtr(other)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
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); }
public long GetMillisecondsTo(PDateTime d) { long ret = PapillonPINVOKE.PDateTime_GetMillisecondsTo(swigCPtr, PDateTime.getCPtr(d)); if (PapillonPINVOKE.SWIGPendingException.Pending) { throw PapillonPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
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()); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }
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); } }); }
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]); } }
public PDateTime GetOccurrenceTime() { PDateTime ret = new PDateTime(PapillonPINVOKE.PEvent_GetOccurrenceTime(swigCPtr), false); return(ret); }
public static PDateTime CurrentUTC() { PDateTime ret = new PDateTime(PapillonPINVOKE.PDateTime_CurrentUTC(), true); return(ret); }
public PDateTime GetTimestampUTC() { PDateTime ret = new PDateTime(PapillonPINVOKE.PFrame_GetTimestampUTC(swigCPtr), true); return(ret); }
public PDateTime GetDetectionTime() { PDateTime ret = new PDateTime(PapillonPINVOKE.PEvent_GetDetectionTime(swigCPtr), false); return(ret); }
public PDateTime ToUTC() { PDateTime ret = new PDateTime(PapillonPINVOKE.PDateTime_ToUTC(swigCPtr), true); return(ret); }
public PDateTime GetTimestampLatestUpdate() { PDateTime ret = new PDateTime(PapillonPINVOKE.PStore_GetTimestampLatestUpdate(swigCPtr), true); return(ret); }
public PDateTime GetTimestamp() { PDateTime ret = new PDateTime(PapillonPINVOKE.PEntity_GetTimestamp(swigCPtr), true); return(ret); }
public static PDateTime Bad() { PDateTime ret = new PDateTime(PapillonPINVOKE.PDateTime_Bad(), false); return(ret); }
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); }
public PDateTime AddMillisecond(long n) { PDateTime ret = new PDateTime(PapillonPINVOKE.PDateTime_AddMillisecond(swigCPtr, n), true); return(ret); }
public static PDateTime FromMillisecondsSinceEpoch(long n) { PDateTime ret = new PDateTime(PapillonPINVOKE.PDateTime_FromMillisecondsSinceEpoch(n), true); return(ret); }