public void Setup() { b = new List <Booking>() { new Booking { Id = 1, FullName = "SB", RoomType = "Single", AdhaarCardNo = 253624 }, new Booking { Id = 2, FullName = "DK", RoomType = "Double", AdhaarCardNo = 782134 }, new Booking { Id = 3, FullName = "SS", RoomType = "Suite", AdhaarCardNo = 516273 } }; var loandata = b.AsQueryable(); var mockSet = new Mock <DbSet <Booking> >(); mockSet.As <IQueryable <Booking> >().Setup(m => m.Provider).Returns(loandata.Provider); mockSet.As <IQueryable <Booking> >().Setup(m => m.Expression).Returns(loandata.Expression); mockSet.As <IQueryable <Booking> >().Setup(m => m.ElementType).Returns(loandata.ElementType); mockSet.As <IQueryable <Booking> >().Setup(m => m.GetEnumerator()).Returns(loandata.GetEnumerator()); var mockContext = new Mock <hoteldbContext>(); mockContext.Setup(c => c.Booking).Returns(mockSet.Object); adb = mockContext.Object; }
public void Setup() { r1 = new List <RoomType>() { new RoomType { RoomId = 1, RoomType1 = "Single", PriceInRs = 2536 }, new RoomType { RoomId = 2, RoomType1 = "Double", PriceInRs = 1600 }, new RoomType { RoomId = 3, RoomType1 = "Suite", PriceInRs = 1200 }, }; var loandata = r1.AsQueryable(); var mockSet = new Mock <DbSet <RoomType> >(); mockSet.As <IQueryable <RoomType> >().Setup(m => m.Provider).Returns(loandata.Provider); mockSet.As <IQueryable <RoomType> >().Setup(m => m.Expression).Returns(loandata.Expression); mockSet.As <IQueryable <RoomType> >().Setup(m => m.ElementType).Returns(loandata.ElementType); mockSet.As <IQueryable <RoomType> >().Setup(m => m.GetEnumerator()).Returns(loandata.GetEnumerator()); var mockContext = new Mock <hoteldbContext>(); mockContext.Setup(c => c.RoomType).Returns(mockSet.Object); db = mockContext.Object; }
public roomController(hoteldbContext context) { _context = context; }
public loginrepo(IConfiguration config, hoteldbContext context) { _config = config; _context = context; }
public TokenValidateController(IConfiguration config, hoteldbContext context) { _config = config; _context = context; }
public bookingrepo(hoteldbContext _db) { db = _db; }
public BoarderController(hoteldbContext context) { _context = context; }
public bookingController(hoteldbContext context) { _context = context; }
public roomtyperepo(hoteldbContext _hdb) { hdb = _hdb; }