private Task <ToastModel> AdornToast(ToastModel toast) { return(Task <ToastModel> .Run(() => { Message?.Invoke("adorning toast"); Thread.Sleep(RandomNumbers.GetInteger(100)); toast.WithButter = RandomNumbers.GetDouble() > 0.5; Thread.Sleep(RandomNumbers.GetInteger(100)); toast.WithJelly = RandomNumbers.GetDouble() > 0.5; Thread.Sleep(RandomNumbers.GetInteger(100)); Message?.Invoke(toast.ToString()); return toast; })); }
private Task <CoffeeModel> AdornCoffee(CoffeeModel coffee) { return(Task <CoffeeModel> .Run(() => { Message?.Invoke("adorning coffee"); Thread.Sleep(RandomNumbers.GetInteger(100)); coffee.WithMilk = RandomNumbers.GetDouble() > 0.5; Thread.Sleep(RandomNumbers.GetInteger(100)); coffee.WithSugar = RandomNumbers.GetDouble() > 0.5; Thread.Sleep(RandomNumbers.GetInteger(100)); Message?.Invoke(coffee.ToString()); return coffee; })); }