-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCodeToRefactor.cs
88 lines (79 loc) · 2.83 KB
/
CodeToRefactor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
using System;
using System.Collections.Generic;
using System.Linq;
namespace CodingAssessment.Refactor
{
//Classes in this file is deprecated and new classes have been created to refctor these classes.
//Person, IPersonService,PersonService,BirthingUnit,IBirthingUnit,MarriageService,IMarriageService
//Commenting out this file as its rewritten in new files
//public class People
//{
// private static readonly DateTimeOffset Under16 = DateTimeOffset.UtcNow.AddYears(-15);
// public string Name { get; private set; }
// public DateTimeOffset DOB { get; private set; }
// public People(string name) : this(name, Under16.Date)
// {
// }
// public People(string name, DateTime dob)
// {
// Name = name;
// DOB = dob;
// }
//}
//public class BirthingUnit
//{
// /// <summary>
// /// MaxItemsToRetrieve
// /// </summary>
// private List<People> _people;
// public BirthingUnit()
// {
// _people = new List<People>();
// }
// /// <summary>
// /// GetPeoples
// /// </summary>
// /// <param name="j"></param>
// /// <returns>List<object></returns>
// public List<People> GetPeople(int i)
// {
// for (int j = 0; j < i; j++)
// {
// try
// {
// // Creates a dandon Name
// string name = string.Empty;
// var random = new Random();
// if (random.Next(0, 1) == 0) {
// name = "Bob";
// }
// else {
// name = "Betty";
// }
// // Adds new people to the list
// _people.Add(new People(name, DateTime.UtcNow.Subtract(new TimeSpan(random.Next(18, 85) * 356, 0, 0, 0))));
// }
// catch (Exception e)
// {
// // Dont think this should ever happen
// throw new Exception("Something failed in user creation");
// }
// }
// return _people;
// }
// private IEnumerable<People> GetBobs(bool olderThan30)
// {
// return olderThan30 ? _people.Where(x => x.Name == "Bob" && x.DOB >= DateTime.Now.Subtract(new TimeSpan(30 * 356, 0, 0, 0))) : _people.Where(x => x.Name == "Bob");
// }
// public string GetMarried(People p, string lastName)
// {
// if (lastName.Contains("test"))
// return p.Name;
// if ((p.Name.Length + lastName).Length > 255)
// {
// (p.Name + " " + lastName).Substring(0, 255);
// }
// return p.Name + " " + lastName;
// }
//}
}