Exemplo n.º 1
0
        public void CheckingMovieWithoutShowsForTodayReturnsFalse()
        {
            FilterService serviceUnderTest = new FilterService();

            _movie = new SimpleMovie
            {
                Name  = "Just another day",
                Genre = new List <string>
                {
                    "Action"
                },
                Shows = new List <SimpleShow>
                {
                    new SimpleShow
                    {
                        ShowDate = DateTime.Today.Date.AddDays(1.0),
                        Start    = "10:00"
                    }
                }
            };

            var actual = _serviceUnderTest.Check(_movie);

            Assert.False(actual);
        }
Exemplo n.º 2
0
        public bool Check(SimpleMovie movie)
        {
            if (Title != null)
            {
                if (!movie.Name.ToLower().Contains(Title.ToLower()))
                {
                    return(false);
                }
            }

            if (Category != null)
            {
                if (!movie.Genre.Contains(Category))
                {
                    return(false);
                }
            }

            if (movie.Shows.Count == 0)
            {
                return(false);
            }
            else
            {
                int showsAfter = 0;
                foreach (var s in movie.Shows)
                {
                    if (s.ShowDate.Date.Equals(DateTime.Today))
                    {
                        if (Start != default(TimeSpan) && End != default(TimeSpan))
                        {
                            TimeSpan showHour = TimeSpan.Parse(s.Start);
                            if ((showHour > Start) && (showHour < End))
                            {
                                showsAfter++;
                            }
                        }
                        else
                        {
                            showsAfter++;
                        }
                    }
                }

                if (showsAfter == 0)
                {
                    return(false);
                }
            }

            return(true);
        }
Exemplo n.º 3
0
    private SimpleMovie CreateSimpleMovieStructure(Movie movie)
    {
        SimpleMovie sm = new SimpleMovie();

        if (movie != null)
        {
            sm.id = movie.MovieId;
            movie.MovieClipCollection.Sort("EndFrame ASC");
            for (int i = 0; i < movie.MovieClipCollection.Count; i++)
            {
                sm.clips[i] = CreateSimpleClipStructure(movie.MovieClipCollection[i]);
            }
        }
        return(sm);
    }
Exemplo n.º 4
0
        public void CheckingMovieWithoutShowsReturnsFalse()
        {
            SimpleMovie movie = new SimpleMovie
            {
                Name  = "Just another day",
                Genre = new List <string>
                {
                    "Action"
                },
                Shows = new List <SimpleShow>()
            };

            var actual = _serviceUnderTest.Check(movie);

            Assert.False(actual);
        }
Exemplo n.º 5
0
 public FilterServiceUnitTests()
 {
     _title            = "Just antoher day";
     _genre            = "Action";
     _serviceUnderTest = new FilterService();
     _movie            = new SimpleMovie
     {
         Name  = _title,
         Genre = new List <string>
         {
             _genre
         },
         Shows = new List <SimpleShow>
         {
             new SimpleShow
             {
                 ShowDate = DateTime.Today.Date,
                 Start    = "10:00"
             }
         }
     };
 }
Exemplo n.º 6
0
 public SimpleMovieViewModel(SimpleMovie movie)
 {
     SimpleMovie = movie;
 }
Exemplo n.º 7
0
 public SimpleMovieViewModel(SimpleMovie movie)
 {
     SimpleMovie = movie;
 }