private Task MakeBaconAsync() { return(Task.Run(() => { Message?.Invoke("bacon down"); Thread.Sleep(RandomNumbers.GetInteger(1000)); Message?.Invoke("bacon up!"); })); }
private Task <CoffeeModel> MakeCoffeeAsync() { return(Task <CoffeeModel> .Run(() => { Message?.Invoke("coffee down"); Thread.Sleep(RandomNumbers.GetInteger(1000)); Message?.Invoke("coffee up!"); return new CoffeeModel(); })); }
private Task <ToastModel> MakeToastAsync() { return(Task.Run(() => { Message?.Invoke("toast down"); Thread.Sleep(RandomNumbers.GetInteger(1000)); Message?.Invoke("toast up!"); return new ToastModel(); })); }
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; })); }