public void Init() { var donors = new List<Donor> { new Donor{DonorID = 1, Name = "UN - World Food Program", DonorCode = "WFP", IsResponsibleDonor = true, IsSourceDonor = true, LongName = "UN - World Food Program"}, new Donor{DonorID = 2, Name = "UK", DonorCode = "UK", IsResponsibleDonor = true, IsSourceDonor = true, LongName = "United Kingdom"}, }; var donorService = new Mock<IDonorService>(); donorService.Setup(t => t.GetAllDonor()).Returns(donors); _donorController = new DonorController(donorService.Object); }
public void Index_View_Data_Test() { DonorController controller = new DonorController(); ViewResult view = controller.Index(); Assert.IsInstanceOfType(view.ViewData.Model, typeof( List<BLL.Donor> )); }
public void Index_View_Test() { DonorController controller = new DonorController(); ViewResult view = controller.Index(); Assert.AreEqual("",view.ViewName); }
public void Index_View_Data_Count_Test() { DonorController controller = new DonorController(); ViewResult view = controller.Index(); Assert.AreEqual(((List<BLL.Donor>)view.ViewData.Model).Count, new BLL.CTSContext().Donors.Count()); }