public BaseApiController() { DBContext = new JVContext(); UserExtManager = new UserExtensionManager(DBContext); RatingManager = new UserRatingManager(DBContext); LookupManager = new LookupDataManager(DBContext); MarketManager = new MarketManager(DBContext, RatingManager); Configuration = new HttpConfiguration(); Configuration.Services.Add(typeof(IExceptionLogger), new NLogExceptionLogger()); }
public void GetAverageRating_AverageCalulatedCorrectly_expectedAverageEqualsActual() { const double expectedAverage = 3.33; using (var ratingManager = new UserRatingManager(new FakeBrothershipUnitOfWork())) { double actualAverage = ratingManager.GetAverageRating(2); Assert.AreEqual(expectedAverage, expectedAverage); } }
public void GetAllByUserId_AllRatingsReturned_expectedCountEqualsActual() { const int expectedCount = 3; const int userId = 2; using (var ratingManager = new UserRatingManager(new FakeBrothershipUnitOfWork())) { int actualCount = ratingManager.GetAllByUserUserRatings(userId).Count; Assert.AreEqual(expectedCount, actualCount); } }
public void GetById_CorrectRatingReturned_expectedRatingEqualsActual() { var expectedRating = new UserRating { RaterUserID = 3, UserBeingRatedID = 2, Comment = "Okay", RatingID = 4 }; using (var ratingManager = new UserRatingManager(new FakeBrothershipUnitOfWork())) { var actualRating = ratingManager.GetById(expectedRating.RaterUserID, expectedRating.UserBeingRatedID); AssertRatingsEqual(expectedRating, actualRating); } }