-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPoem.cs
57 lines (52 loc) · 1.92 KB
/
Poem.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
namespace notebook
{
public class Poem
{
public static void Main(string[] args)
{
var me = Person.GetByReference("me");
var you = Person.GetByReference("you");
while(me.DoThinkAbout(you))
{
if(Calendar.Today.CelebratedProfession == you.Profession)
{
try
{
Collection<Skill> myMainSkill = me
.Skills
.OrderByDescending(s => s.Profficency)
.First();
Collection<Feeling> myMotivation = me.GetFeelings(you);
Gift myGift = GiftFactory
.CreateGiftAsync(me, myMainSkill, myMotivation)
.Result;
bool giftAccepted = myGift
.SendToAsync(you)
.Result;
if (giftAccepted)
{
foreach(var feeling in me.GetFeelings(you))
{
// TODO: remove validation
if(!feeling.IsRated)
{
Console.WriteLine(feeling);
}
}
}
else
{
myGift.Destroy();
}
} // Do I need to explain what I mean with "available"?
catch(PersonNotAvailableException ex)
{
// May throw InvalidOperationException
me.Ideas
.RemoveAll(i => i.Contains(you));
}
}
}
}
}
}