예제 #1
0
 public Promise ShouldHaveLicensesCoach(Team team, ValidationOutcome outcome)
 {
     return(Promise.Delay(TimeSpan.FromMilliseconds(10)).Then((d, s) =>
     {
         var coach = team.Coach;
         if (coach == null)
         {
             outcome.AddError("Coach", "Coach is required");
         }
         else if (string.IsNullOrEmpty(coach.License))
         {
             outcome.AddError("Coach.License", "Licensed Coach is required");
         }
     }));
 }
예제 #2
0
 private static Promise <string> GetWeather(int zipCode)
 {
     return(Promise.Delay(100.Millis()).Then((r, s) =>
                                             $"Today's weather for {zipCode} is Rainy, high of 75"));
 }