Exemplo n.º 1
0
        public static Maybe <TeaTimerDefinition> Create(string name, int minutes, int seconds)
        {
            var time = MinuteAndSecond.Create(minutes, seconds);

            if (time.IsError)
            {
                return((Error)time);
            }

            return(Create(name, time));
        }
Exemplo n.º 2
0
        public static Maybe <TeaTimerDefinition> Create(string name, MinuteAndSecond time)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(new ValidationError <string>(
                           "Name", name, "Name must not be empty"));
            }
            if (time == null)
            {
                return(new ValidationError <MinuteAndSecond>(
                           "Time", time, "Time must not be null"));
            }

            return(new TeaTimerDefinition(name, time));
        }
Exemplo n.º 3
0
 private TeaTimerDefinition(string name, MinuteAndSecond time)
 {
     Name = name;
     Time = time;
 }