Created
July 27, 2011 06:02
-
-
Save timwingfield/1108768 to your computer and use it in GitHub Desktop.
Setting up a Stub with Moq
This file contains hidden or 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
[TestFixture] | |
public class When_loading_the_vehicle_list_and_there_two_available_vehicles : Specification | |
{ | |
protected Mock<IVehicleRepository> _vehicleRepository; | |
protected List<Vehicle> _vehicles; | |
protected VehicleViewModel _vehicleViewModel; | |
protected override void before_each() | |
{ | |
_vehicles = new List<Vehicle>{ new Vehicle(), new Vehicle() }; | |
_vehicleRepository.Setup(x => x.GetAll()).Returns(_vehicles); | |
_vehicleViewModel = new VehicleViewModel(_vehicleRepository.Object); | |
} | |
[Test] | |
public void then_the_vehicles_list_should_have_two_vehicles() | |
{ | |
_vehicleViewModel.VehicleList.Count.Should().Equal(2); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment