PageRenderTime 36ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/UnitTests/DataClasses/Person.cs

http://github.com/fredericaltorres/DynamicSugarNet
C# | 65 lines | 32 code | 10 blank | 23 comment | 2 complexity | bfd25debdca673183ca997390a332e61 MD5 | raw file
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace DynamicSugarSharp_UnitTests {
  6. public class Address {
  7. public string Street;
  8. public string ZipCode;
  9. public string State;
  10. }
  11. /// <summary>
  12. /// A test class
  13. /// </summary>
  14. ///
  15. public class Person {
  16. public string LastName;
  17. public string FirstName { get; set; }
  18. public int Age { get; set; }
  19. public DateTime BirthDay { get; set; }
  20. public Address Address = new Address();
  21. public List<string> DrivingLicenses = new List<string>();
  22. /// <summary>
  23. ///
  24. /// </summary>
  25. /// <returns></returns>
  26. public override string ToString() {
  27. return this.Format("LastName:{LastName}, FirstName:{FirstName}, Age:{Age}, BirthDay:{BirthDay}, DrivingLicenses:{DrivingLicenses}");
  28. }
  29. /// <summary>
  30. /// Implemented to test calling method with no parameter
  31. /// </summary>
  32. /// <returns></returns>
  33. public string GetLastName() {
  34. return this.LastName;
  35. }
  36. /// <summary>
  37. ///
  38. /// </summary>
  39. /// <returns></returns>
  40. public string GetUniqueID(){
  41. return this.Format("#{LastName}.{FirstName}.{BirthDay:yyyy}");
  42. }
  43. /// <summary>
  44. /// Define how to determine if the person are the same.
  45. /// Implementing this method is required to use the extension
  46. /// method In().
  47. /// </summary>
  48. /// <param name="obj"></param>
  49. /// <returns></returns>
  50. public override bool Equals(object obj) {
  51. Person p = obj as Person;
  52. return (this.LastName==p.LastName) && (this.FirstName==p.FirstName) && (this.BirthDay==p.BirthDay);
  53. }
  54. }
  55. }