public void ShouldReturnAllKnownMilestonesForSpecificGoal() { //Arrange int goalId = 1; string expectedSQLStatement = "SELECT * FROM saver.Milestones WHERE goalid = @GoalId ORDER BY id ASC;"; IEnumerable <Model.Milestone> expectedMilestones = new List <Model.Milestone>() { new Model.Milestone(1, 100, "Testing 1", null), new Model.Milestone(1, 200, "Testing 2", null), new Model.Milestone(1, 300, "Testing 3", null), new Model.Milestone(1, 400, "Testing 4", null), new Model.Milestone(1, 500, "Testing 5", null) }; //Setup the mocks mockDataAccess.Setup(da => da.ExecuteQuery <Model.Milestone> ( It.Is <string>(val => val.Equals(expectedSQLStatement)), It.Is <Dictionary <string, object> >(val => (int)val["GoalId"] == goalId) ) ).Returns(expectedMilestones); mockSqlStringService.Setup(ss => ss.GetSqlFromResource(It.IsAny <string>())).Returns(expectedSQLStatement); IMilestoneRepository repository = new MilestoneRepository(mockDataAccess.Object, mockSqlStringService.Object); //Act IEnumerable <Model.Milestone> returnedMilestones = repository.GetForGoal(goalId); //Assert returnedMilestones.Should().NotBeNull(); returnedMilestones.Count().Should().Be(5); returnedMilestones.Should().Contain(expectedMilestones); }