Last active
January 25, 2016 13:45
-
-
Save serialseb/49fc9d939d74b83ba02d to your computer and use it in GitHub Desktop.
vest-specifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
examples of VEST specifications |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class RestFlixApp { | |
public IView CurrentView { get; set; } | |
public MovieBrowser MovieBrowser { get; } | |
/* Implementation details */ | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class movie_available : movie_browser_context { | |
movie_avaialble() { | |
given_valid_account(Users.Anna); | |
given_available_movies(Movies.StarWarsEpisodeIV); | |
when_user_logs_in(Users.Anna); | |
} | |
[Test] | |
void see_list_of_avaialble_movies() { | |
app.CurrentView.ShouldEqual(app.MovieBrowser); | |
} | |
[Test] | |
void can_see_movie_in_list() { | |
app.MovieBrowser.Movies.ShouldContain(Movies.StarWarsEpisodeIV); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class movie_browser_context { | |
movie_browser_context() { | |
app = new RestFlixApp(); | |
users - new UserRepository(); | |
movies = new MovieRepository(); | |
} | |
void given_valid_account(User user){ | |
users.Add(user); | |
} | |
void given_available_movies(params IEnumerable<Movie> movies) { | |
movies.AddRange(movies); | |
} | |
void when_user_logs_in(User user) { | |
app.Login(user); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment