Beispiel #1
0
        private static void TestPerson()
        {
            var p = new Person(1, new EmailAddress("*****@*****.**"), new Kilogram(55));

            p.Thicken((Kilogram)1.25d);
            Console.WriteLine(p);
            p.Thicken(Kilogram.FromGrams(1000d));
            Console.WriteLine(p);
            p.SendEmail(new EmailAddress("*****@*****.**"), "teest", "test");
        }
Beispiel #2
0
        private static void TestKilogram()
        {
            var a = new Kilogram(82.5d);
            var b = new Kilogram(95.75d);
            var c = new Kilogram(95.0005d);

            Console.WriteLine($"{a} = {a.ToDekagrams()} dkg");
            Console.WriteLine($"{a} = {a.ToGrams()} g");
            Console.WriteLine($"{a} = {a.ToTons()} t");

            Console.WriteLine($"{a} >  {b} = {a > b}");
            Console.WriteLine($"{a} == {b} = {a == b}");
            Console.WriteLine($"{a} +  {b} = {a + b}");
        }
Beispiel #3
0
 public Person(int id, EmailAddress address, Kilogram weight)
 {
     Id      = id;
     Address = address;
     Weight  = weight;
 }
Beispiel #4
0
 // Zapouzdřené ztloustnutí osoby
 public void Thicken(Kilogram additionalWeight)
 {
     Console.WriteLine($"Ztučňuji osobu o {additionalWeight}");
     Weight = Weight.Combine(additionalWeight);
 }