Commit 513903e
Changed files (2)
domain
test
domain/movie_library.go
@@ -41,6 +41,12 @@ func (self *MovieLibrary) FindAllMoviesByPixarOrDisney() []Movie {
})
}
+func (self *MovieLibrary) FindAllMoviesNotByPixar() []Movie {
+ return self.FindAll(func(x Movie) bool {
+ return x.Studio.Name != "Pixar"
+ })
+}
+
func (self *MovieLibrary) Add(movie Movie) {
found := self.Find(func(x Movie) bool {
return x.Equals(movie)
test/unit/movie_library_test.go
@@ -74,5 +74,19 @@ func TestMovieLibrary(t *testing.T) {
assert.ElementsMatch(t, expected, movies)
})
+
+ t.Run("returns all movies not published by Pixar", func(t *testing.T) {
+ movies := subject.FindAllMoviesNotByPixar()
+ expected := [...]domain.Movie{
+ chasing_amy,
+ dumbo,
+ fantasia,
+ man_on_fire,
+ pinocchio,
+ shawshank_redemption,
+ }
+
+ assert.ElementsMatch(t, expected, movies)
+ })
})
}