Exemplo 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 );
        }
Exemplo 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 );
        }
Exemplo 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 );
        }
Exemplo 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;
 }
Exemplo 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 );
        }
Exemplo n.º 6
0
        public void GetEmptyDateTimeTest()
        {
            DateTime dateTime = new DateTime( 2009, 7, 22 );
            Time time = new Time();

            Assert.AreEqual( time.GetDateTime( dateTime ), dateTime );
        }
Exemplo 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 ) );
        }
Exemplo 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 );
        }
Exemplo 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 );
        }
Exemplo n.º 10
0
 // ----------------------------------------------------------------------
 public DayHourRange( DayOfWeek day, Time start, Time end )
     : base(start, end)
 {
     this.day = day;
 }
Exemplo n.º 11
0
 // ----------------------------------------------------------------------
 public DateTime GetDateTime( Time time )
 {
     return date.Add( time.Duration );
 }
Exemplo n.º 12
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="from"></param>
 public SerializableTime(Time from)
 {
     _data = from.Duration;
 }
Exemplo 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);
 }