Skip to content

Instantly share code, notes, and snippets.

@serialseb
Last active January 25, 2016 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serialseb/49fc9d939d74b83ba02d to your computer and use it in GitHub Desktop.
Save serialseb/49fc9d939d74b83ba02d to your computer and use it in GitHub Desktop.
vest-specifications
examples of VEST specifications
public class RestFlixApp {
public IView CurrentView { get; set; }
public MovieBrowser MovieBrowser { get; }
/* Implementation details */
}
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);
}
}
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