public void Task_GetAppointmentsByFilter_MatchResult() { //Arrange var id = 1; var organizerId = 1; IQueryable <Appointment> eppointmentList = new List <Appointment>() { new Appointment() { OrganizerId = organizerId, Id = id }, new Appointment() { OrganizerId = 2, Id = 2 } }.AsQueryable(); AppointmentRepositoryMock.Setup(m => m.Get(s => s.OrganizerId.Equals(organizerId), null)).Returns(eppointmentList).Verifiable(); //Act var actual = AppointmentsBusinessManager.Get(s => s.OrganizerId.Equals(organizerId)); //Assert Assert.IsInstanceOfType(actual, typeof(IQueryable <Appointment>)); //passes Assert.AreEqual(organizerId, actual.ToArray()[0].OrganizerId); //assert that actual result was as expected Assert.AreEqual(eppointmentList.Count(), actual.Count()); //assert count }
public void Task_GetAppointments_MatchResult() { //Arrange IQueryable <Appointment> eppointmentList = new List <Appointment>() { new Appointment() { OrganizerId = 1, Id = 1 }, new Appointment() { OrganizerId = 2, Id = 2 } }.AsQueryable(); AppointmentRepositoryMock.Setup(m => m.Get(null, null)).Returns(eppointmentList).Verifiable(); //Act var actual = AppointmentsBusinessManager.Get(); //Assert Assert.IsInstanceOfType(actual, typeof(IQueryable <Appointment>)); //passes Assert.AreEqual(eppointmentList.ToArray()[0].OrganizerId, actual.ToArray()[0].OrganizerId); //assert that actual result was as expected Assert.AreEqual(eppointmentList.ToArray()[0].Id, actual.ToArray()[0].Id); //assert that actual result was as expected Assert.AreEqual(eppointmentList.ToArray()[1].OrganizerId, actual.ToArray()[1].OrganizerId); //assert that actual result was as expected Assert.AreEqual(eppointmentList.ToArray()[1].Id, actual.ToArray()[1].Id); //assert that actual result was as expected }
public void Task_GetEmptyAppointments_Return_EmptyList() { //Arrange IQueryable <Appointment> eppointmentList = new List <Appointment>().AsQueryable(); AppointmentRepositoryMock.Setup(m => m.Get(null, null)).Returns(eppointmentList).Verifiable(); //Act var actual = AppointmentsBusinessManager.Get(); //Assert Assert.AreEqual(eppointmentList.Count(), actual.Count()); //passes }
public void Task_GetAppointments_Return_ListOfAppointment() { //Arrange IQueryable <Appointment> eppointmentList = new List <Appointment>() { new Appointment() { OrganizerId = 1, Id = 1 }, new Appointment() { OrganizerId = 2, Id = 2 } }.AsQueryable(); AppointmentRepositoryMock.Setup(m => m.Get(null, null)).Returns(eppointmentList).Verifiable(); //Act var actual = AppointmentsBusinessManager.Get(); //Assert Assert.IsInstanceOfType(actual, typeof(IQueryable <Appointment>)); //passes }