public void GetAll_Returns_All_Journals() { //Arrange IJournalRepository repository = JournalMocks.MockJournalRepositoryWithContext(); //Act var actual = repository.GetAllJournals(); var expected = JournalMocks.JournalData.Where(j => j.Id > 0 && (j.JournalId == 0 || j.JournalId == null)).ToList(); //Assert Assert.IsNotNull(actual); Assert.AreEqual(actual.Count, expected.Count); Assert.IsTrue(actual.All(j => (j.JournalId == 0 || j.JournalId == null) && j.Id > 0)); }
private SubscriberController ArrangeSubscriberController(UserProfile profile) { Mapper.CreateMap <JournalViewModel, Journal>(); Mapper.CreateMap <Journal, JournalViewModel>(); var repository = JournalMocks.MockJournalRepositoryWithContext(); var service = JournalMocks.MockSubscriptionServiceWithContext(); IStaticMembershipService memServiceMock = JournalMocks.MockIStaticMembershipService(profile).MockObject; ISessionProvider sessionProvider = JournalMocks.MockISessionProvider(profile).MockObject; SubscriberController controller = new SubscriberController(repository, service, memServiceMock); controller.CheckRequestAuthenticatd = false; controller.SetSessionProvider(sessionProvider); return(controller); }
public void GetAll_Issues_Returns_OnlyIssues() { //Arrange IJournalRepository repository = JournalMocks.MockJournalRepositoryWithContext(); int journalID = 2; //Act var actual = repository.GetAllIssuesOfJournal(journalID); var expected = JournalMocks.JournalData.Where(j => j.JournalId == journalID).ToList(); //Assert Assert.IsNotNull(actual); Assert.AreEqual(actual.Count, expected.Count); Assert.IsTrue(actual.All(j => j.JournalId == journalID)); }