Commit a5fba92
Changed files (2)
domain
test
domain/movie_library.go
@@ -35,6 +35,12 @@ func (self *MovieLibrary) FindAllMoviesByPixar() []Movie {
})
}
+func (self *MovieLibrary) FindAllMoviesByPixarOrDisney() []Movie {
+ return self.FindAll(func(x Movie) bool {
+ return x.Studio.Name == "Pixar" || x.Studio.Name == "Disney"
+ })
+}
+
func (self *MovieLibrary) Add(movie Movie) {
found := self.Find(func(x Movie) bool {
return x.Equals(movie)
test/unit/movie_library_test.go
@@ -67,5 +67,12 @@ func TestMovieLibrary(t *testing.T) {
assert.ElementsMatch(t, expected, movies)
})
+
+ t.Run("returns all movies published by Pixar or Disney", func(t *testing.T) {
+ movies := subject.FindAllMoviesByPixarOrDisney()
+ expected := [...]domain.Movie{toy_story, cars, up, monsters_inc, fantasia, dumbo, pinocchio}
+
+ assert.ElementsMatch(t, expected, movies)
+ })
})
}