public void SelectTimeByMovieIDDatetimeandTimeTest() { DateTime timeStart = new DateTime(2018, 7, 20, 0, 0, 0); string comparedatetime1 = timeStart.ToString($"{timeStart:yyyy-MM-dd}"); TimeSpan timeSpan = new TimeSpan(8, 0, 0); string time = string.Format("{0:D2}:{1:D2}:{2:D2}", timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds); // Movie id , DateTime , Time =>>> Assert.NotNull(sch.SelectTimeBy(1, comparedatetime1, time)); }
public void TestSelectScheduleByDatimeMovieIdTrue() { // 2018-08-01 DateTime timeStart = new DateTime(2018, 08, 01, 0, 0, 0); string comparedatetime1 = timeStart.ToString($"{timeStart:yyyy-MM-dd}"); TimeSpan timeSpan = new TimeSpan(21, 30, 0); string time = string.Format("{0:D2}:{1:D2}:{2:D2}", timeSpan.Hours, timeSpan.Minutes, timeSpan.Seconds); Assert.NotNull(sch.SelectTimeBy(1, comparedatetime1, time)); }
public Schedules SelectTimeBy(int movie_id, string date, string start_time) { string regexDate = @"(?<year>\d{2,4})-(?<month>\d{1,2})-(?<day>\d{1,2})"; string regexTime = @"^(\d{1,2}|\d\.\d{2}):([0-5]\d):([0-5]\d)(\.\d+)?$"; if (Regex.IsMatch(date, regexDate) != true || Regex.IsMatch(start_time, regexTime) != true) { return(null); } return(sche.SelectTimeBy(movie_id, date, start_time)); }
public Schedules SelectTimeBy(int movie_id, string date, string start_time) { Regex regexDate = new Regex(@"(?<year>\d{2,4})-(?<month>\d{1,2})-(?<day>\d{1,2})"); MatchCollection matchCollectionDate = regexDate.Matches(date); Regex regexTime = new Regex(@"^(\d{1,2}|\d\.\d{2}):([0-5]\d):([0-5]\d)(\.\d+)?$"); MatchCollection matchCollectiontime = regexTime.Matches(start_time); if (matchCollectionDate.Count <= 0 || matchCollectiontime.Count <= 0) { return(null); } return(sche.SelectTimeBy(movie_id, date, start_time)); }