public void Test_Delete_IfSerieIsNull() { m_MockSeriePropertyPresenter.Serie = null; ISerieService serieService = ObjectFactory.GetInstance<ISerieService>(); var series = serieService.GetAll(); SeriePropertyPresenter seriePropertyPresenter = new SeriePropertyPresenter(m_MockSeriePropertyPresenter); seriePropertyPresenter.Delete(); Assert.AreEqual(series.Count, serieService.GetAll().Count); }
public void Test_Delete_IfSerieIsNotNull() { ISerieService serieService = ObjectFactory.GetInstance<ISerieService>(); int oldSerieCount = serieService.GetAll().Count; serieService.SaveOrUpdate(new Serie{ Id = 0, Name = "Test", Description = "test", PublicationYear = DateTime.Today, Category = new Category { Id = 1}}); var series = serieService.GetAll(); Assert.AreEqual(oldSerieCount + 1, series.Count); m_MockSeriePropertyPresenter.Serie = series.OrderBy(x => x.Id).LastOrDefault(); SeriePropertyPresenter seriePropertyPresenter = new SeriePropertyPresenter(m_MockSeriePropertyPresenter); seriePropertyPresenter.Delete(); Assert.AreEqual(series.Count-1, serieService.GetAll().Count); }