Esempio n. 1
0
        public void ConstructorHourTest()
        {
            Time time = new Time( 18 );

            Assert.AreEqual( time.Hour, 18 );
            Assert.AreEqual( time.Minute, 0 );
            Assert.AreEqual( time.Second, 0 );
            Assert.AreEqual( time.Millisecond, 0 );
        }
Esempio n. 2
0
        public void ConstructorTest()
        {
            Time time = new Time( 18, 23, 56, 344 );

            Assert.AreEqual( time.Hour, 18 );
            Assert.AreEqual( time.Minute, 23 );
            Assert.AreEqual( time.Second, 56 );
            Assert.AreEqual( time.Millisecond, 344 );
        }
Esempio n. 3
0
        public void DateTimeConstructorTest()
        {
            DateTime test = new DateTime( 2009, 7, 22, 18, 23, 56, 344 );
            Time time = new Time( test );

            Assert.AreEqual( time.Hour, test.Hour );
            Assert.AreEqual( time.Minute, test.Minute );
            Assert.AreEqual( time.Second, test.Second );
            Assert.AreEqual( time.Millisecond, test.Millisecond );
        }
Esempio n. 4
0
 /// <summary>
 /// Constructor for any transaction
 /// </summary>
 /// <param name="date"></param>
 /// <param name="description"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <param name="code"></param>
 /// <param name="amount"></param>
 /// <param name="notes"></param>
 public Transaction(Date date, Time time, TimeZoneInfo zone, String description, Contact.PaymentAccount from, Contact.PaymentAccount to, 
     Transaction.Code code, Decimal amount, String currency, String transactionId, String notes)
     : base()
 {
     this.Date = date;
     this.Time = time;
     this.TimeZone = zone;
     this.Description = description;
     this.From = from;
     this.To = to;
     this.Type = code;
     this.Amount = amount;
     this.Currency = currency;
     this.TransactionId = transactionId ?? String.Empty;
     this.Note = notes ?? String.Empty;
 }
Esempio n. 5
0
        public void DurationTest()
        {
            TimeSpan test = new TimeSpan( 0, 18, 23, 56, 344 );
            Time time = new Time( test.Hours, test.Minutes, test.Seconds, test.Milliseconds );

            Assert.AreEqual( time.Hour, test.Hours );
            Assert.AreEqual( time.Minute, test.Minutes );
            Assert.AreEqual( time.Second, test.Seconds );
            Assert.AreEqual( time.Millisecond, test.Milliseconds );

            Assert.AreEqual( time.Duration.Ticks, test.Ticks );

            Assert.AreEqual( time.TotalHours, test.TotalHours );
            Assert.AreEqual( time.TotalMinutes, test.TotalMinutes );
            Assert.AreEqual( time.TotalSeconds, test.TotalSeconds );
            Assert.AreEqual( time.TotalMilliseconds, test.TotalMilliseconds );
        }
Esempio n. 6
0
        public void GetEmptyDateTimeTest()
        {
            DateTime dateTime = new DateTime( 2009, 7, 22 );
            Time time = new Time();

            Assert.AreEqual( time.GetDateTime( dateTime ), dateTime );
        }
Esempio n. 7
0
        public void GetDateTimeTest()
        {
            DateTime dateTime = new DateTime( 2009, 7, 22 );
            TimeSpan timeSpan = new TimeSpan( 0, 18, 23, 56, 344 );
            Time time = new Time( timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds, timeSpan.Milliseconds );

            Assert.AreEqual( time.GetDateTime( dateTime ), dateTime.Add( timeSpan ) );
        }
Esempio n. 8
0
        public void EmptyDateTimeConstructorTest()
        {
            DateTime test = new DateTime( 2009, 7, 22 );
            Time time = new Time( test );

            Assert.AreEqual( time.Hour, 0 );
            Assert.AreEqual( time.Minute, 0 );
            Assert.AreEqual( time.Second, 0 );
            Assert.AreEqual( time.Millisecond, 0 );
            Assert.AreEqual( time.Ticks, 0 );
            Assert.AreEqual( time.Duration, TimeSpan.Zero );
            Assert.AreEqual( time.TotalHours, 0 );
            Assert.AreEqual( time.TotalMinutes, 0 );
            Assert.AreEqual( time.TotalSeconds, 0 );
            Assert.AreEqual( time.TotalMilliseconds, 0 );
        }
Esempio n. 9
0
        public void EmptyConstructorTest()
        {
            Time time = new Time();

            Assert.AreEqual( time.Hour, 0 );
            Assert.AreEqual( time.Minute, 0 );
            Assert.AreEqual( time.Second, 0 );
            Assert.AreEqual( time.Millisecond, 0 );
            Assert.AreEqual( time.Ticks, 0 );
            Assert.AreEqual( time.Duration, TimeSpan.Zero );
            Assert.AreEqual( time.TotalHours, 0 );
            Assert.AreEqual( time.TotalMinutes, 0 );
            Assert.AreEqual( time.TotalSeconds, 0 );
            Assert.AreEqual( time.TotalMilliseconds, 0 );
        }
Esempio n. 10
0
 // ----------------------------------------------------------------------
 public DayHourRange( DayOfWeek day, Time start, Time end )
     : base(start, end)
 {
     this.day = day;
 }
Esempio n. 11
0
 // ----------------------------------------------------------------------
 public DateTime GetDateTime( Time time )
 {
     return date.Add( time.Duration );
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="from"></param>
 public SerializableTime(Time from)
 {
     _data = from.Duration;
 }
Esempio n. 13
0
 /// <summary>
 /// Constructor for Paypal transactions
 /// </summary>
 /// <param name="datetime"></param>
 /// <param name="description"></param>
 /// <param name="from"></param>
 /// <param name="to"></param>
 /// <param name="code"></param>
 /// <param name="amount"></param>
 /// <param name="notes"></param>
 /// <returns></returns>
 public static Transaction Generate(Date date, Time time, TimeZoneInfo zone, String description, Transaction.Code code, 
     String currency, Decimal amount, String from, String to, String transactionId, String notes = null)
 {
     return new Transaction(date, time, zone, description, Contact.PaymentAccount.FromEmail(from), Contact.PaymentAccount.FromEmail(to),
         code, amount, currency, transactionId, notes);
 }