public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); _properties = Substitute.For <IDbSet <Domain.Models.Property> >(); _context.Properties.Returns(_properties); _handler = new ListPropertyCommandHandler(_context); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); _context.Properties.Returns(Substitute.For <IDbSet <Domain.Models.Property> >()); _handler = new CreatePropertyCommandHandler(_context); _offerHandler = new MakeOfferCommandHandler(_context); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); _properties = Substitute.For <IDbSet <Models.Property> >(); _context.Properties.Returns(_properties); _handler = new BookAppointmentCommandHandler(_context); }
public void SetUp() { MockData.SetUp(); _context = Substitute.For <IOrangeBricksContext>(); _context.Properties.Returns(MockData.Properties); _context.Offers.Returns(MockData.Offers); }
public void TearDown() { if (_context != null) { _context = null; } }
public void SetUp() { MockData.SetUp(); _context = Substitute.For <IOrangeBricksContext>(); _context.Properties.Returns(MockData.Properties); _context.Offers.Returns(MockData.Offers); _controller = MockData.CreateControllerContext(new OffersController(_context)); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); _viewings = Substitute.For <IDbSet <Models.Viewing> >(); _context.Viewings.Returns(_viewings); _properties = Substitute.For <IDbSet <Models.Property> >(); _context.Properties.Returns(_properties); _handler = new BookViewingCommandHandler(_context); }
public void When_ViewModel_Is_Returned() { _context = Substitute.For <IOrangeBricksContext>(); var builder = new BookViewingViewModelBuilder(_context); _context.Properties.Find(1).Returns(new Models.Property { Id = 1, SellerUserId = "test" }); viewModel = builder.Build(1); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); _handler = new AcceptOfferCommandHandler(_context); var offersFor1 = new List <Offer>() { new Offer() { Id = 1, Amount = 1, BuyerUserId = "1", CreatedAt = DateTime.Now, Status = OfferStatus.Pending, UpdatedAt = DateTime.Now } , new Offer() { Id = 2, Amount = 2, BuyerUserId = "2", CreatedAt = DateTime.Now, Status = OfferStatus.Pending, UpdatedAt = DateTime.Now } }; var offersFor2 = new List <Offer>() { new Offer() { Id = 5, Amount = 5, BuyerUserId = "2", CreatedAt = DateTime.Now, Status = OfferStatus.Pending, UpdatedAt = DateTime.Now } , new Offer() { Id = 6, Amount = 6, BuyerUserId = "1", CreatedAt = DateTime.Now, Status = OfferStatus.Pending, UpdatedAt = DateTime.Now } }; _offers = offersFor1.Union(offersFor2).ToList(); var properties = new List <Models.Property> { new Models.Property { Id = 1, StreetName = "Smith Street", Description = "", IsListedForSale = true, Offers = offersFor1 }, new Models.Property { Id = 2, StreetName = "Jones Street", Description = "", IsListedForSale = true, Offers = offersFor2 } }; var propertiesMockSet = Substitute.For <IDbSet <Models.Property>, IQueryable <Models.Property> >() .Initialize(properties.AsQueryable(), p => p.Id); _context.Properties.Returns(propertiesMockSet); var offersMockSet = Substitute.For <IDbSet <Offer>, IQueryable <Offer> >() .Initialize(_offers.AsQueryable(), o => o.Id); _context.Offers.Returns(offersMockSet); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); var viewings = new List <Models.Viewing> { new Viewing { Id = 1, PropertyId = 1, ViewingAt = new DateTime(2017, 1, 1, 9, 0, 0), BuyerUserId = "123", Status = ViewingStatus.Pending }, }; var mockViewingSet = Substitute.For <IDbSet <Models.Viewing> >() .Initialize(viewings.AsQueryable()); _context.Viewings.Returns(mockViewingSet); _handler = new RejectViewingCommandHandler(_context); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); var offers = new List <Models.Offer> { new Offer { Id = 1, PropertyId = 1, Amount = 1000000, BuyerUserId = "123", Status = OfferStatus.Pending }, }; var mockOfferSet = Substitute.For <IDbSet <Models.Offer> >() .Initialize(offers.AsQueryable()); _context.Offers.Returns(mockOfferSet); _handler = new RejectOfferCommandHandler(_context); }
public void When_User_Books_Viewing() { context = Substitute.For <IOrangeBricksContext>(); context.Properties.Find(1).Returns(new Models.Property { Id = 1 }); context.Viewings.Returns(Substitute.For <IDbSet <Models.Viewing> >()); BookViewingCommandHandler handler = new BookViewingCommandHandler(this.context); BookViewingCommand command = new BookViewingCommand { PropertyId = 1, UserId = "test", ViewingTime = new DateTime(2017, 01, 03, 10, 10, 0) }; handler.Handle(command); }
public void SetUp() { // Setup context mocks _context = Substitute.For <IOrangeBricksContext>(); // Setup propery mocks var properties = new List <Models.Property> { new Models.Property { Id = 1, Description = "Small house", StreetName = "1 Somewhere", NumberOfBedrooms = 1, IsListedForSale = true, PropertyType = "House" } }; var mockPropertySet = Substitute.For <IDbSet <Models.Property> >() .Initialize(properties.AsQueryable()); _context.Properties.Returns(mockPropertySet); _handler = new RequestViewingCommandHandler(_context); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); _handler = new BookAppointmentCommandHandler(_context); var properties = new List <Models.Property> { new Models.Property { Id = 1, StreetName = "Smith Street", Description = "", IsListedForSale = true }, new Models.Property { Id = 2, StreetName = "Jones Street", Description = "", IsListedForSale = true } }; var mockSet = Substitute.For <IDbSet <Models.Property>, IQueryable <Models.Property> >() .Initialize(properties.AsQueryable()); _context.Properties.Returns(mockSet); _context.Appointments.Returns(Substitute.For <IDbSet <Appointment> >()); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); var properties = new List <Models.Property> { new Models.Property { Id = 1, SellerUserId = "888", Description = "Small house", StreetName = "1 Somewhere", NumberOfBedrooms = 1, IsListedForSale = true, PropertyType = "House", Viewings = new List <Models.Viewing> { new Viewing { Id = 1, PropertyId = 1, ViewingAt = new DateTime(2017, 1, 1, 9, 0, 0), BuyerUserId = "123", Status = ViewingStatus.Accepted }, new Viewing { Id = 2, PropertyId = 1, ViewingAt = new DateTime(2017, 1, 1, 10, 0, 0), BuyerUserId = "124", Status = ViewingStatus.Pending } } } }; var mockPropertySet = Substitute.For <IDbSet <Models.Property> >() .Initialize(properties.AsQueryable()); _context.Properties.Returns(mockPropertySet); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); var properties = new List <Models.Property> { new Models.Property { Id = 1, SellerUserId = "888", Description = "Small house", StreetName = "1 Somewhere", NumberOfBedrooms = 1, IsListedForSale = true, PropertyType = "House", Offers = new List <Models.Offer> { new Offer { Id = 1, PropertyId = 1, Amount = 1000000, BuyerUserId = "123", Status = OfferStatus.Accepted }, new Offer { Id = 2, PropertyId = 1, Amount = 2000000, BuyerUserId = "124", Status = OfferStatus.Pending } } } }; var mockPropertySet = Substitute.For <IDbSet <Models.Property> >() .Initialize(properties.AsQueryable()); _context.Properties.Returns(mockPropertySet); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); var viewings = new List <Models.Viewing> { new Models.Viewing { Id = 1, PropertyId = 1, ViewingAt = new DateTime(2017, 1, 1, 9, 0, 0), BuyerUserId = "123", Status = ViewingStatus.Accepted, Property = new Models.Property { Id = 1, Description = "Small house", StreetName = "1 Somewhere", NumberOfBedrooms = 1, IsListedForSale = true, PropertyType = "House" } }, new Models.Viewing { Id = 2, PropertyId = 1, ViewingAt = new DateTime(2017, 1, 1, 10, 0, 0), BuyerUserId = "124", Status = ViewingStatus.Pending, Property = new Models.Property { Id = 1, Description = "Small house", StreetName = "1 Somewhere", NumberOfBedrooms = 1, IsListedForSale = true, PropertyType = "House" } }, new Models.Viewing { Id = 3, PropertyId = 2, ViewingAt = new DateTime(2017, 1, 1, 11, 0, 0), BuyerUserId = "123", Status = ViewingStatus.Accepted, Property = new Models.Property { Id = 2, Description = "Large house", StreetName = "2 Somewhere", NumberOfBedrooms = 8, IsListedForSale = true, PropertyType = "House" } }, new Models.Viewing { Id = 4, PropertyId = 2, ViewingAt = new DateTime(2017, 1, 1, 12, 0, 0), BuyerUserId = "125", Status = ViewingStatus.Pending, Property = new Models.Property { Id = 2, Description = "Large house", StreetName = "2 Somewhere", NumberOfBedrooms = 8, IsListedForSale = true, PropertyType = "House" } } }; var mockViewingSet = Substitute.For <IDbSet <Models.Viewing> >() .Initialize(viewings.AsQueryable()); _context.Viewings.Returns(mockViewingSet); }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); var offers = new List <Models.Offer> { new Models.Offer { Id = 1, PropertyId = 1, Amount = 100000, BuyerUserId = "123", Status = OfferStatus.Accepted, Property = new Models.Property { Id = 1, Description = "Small house", StreetName = "1 Somewhere", NumberOfBedrooms = 1, IsListedForSale = true, PropertyType = "House" } }, new Models.Offer { Id = 2, PropertyId = 1, Amount = 200000, BuyerUserId = "124", Status = OfferStatus.Pending, Property = new Models.Property { Id = 1, Description = "Small house", StreetName = "1 Somewhere", NumberOfBedrooms = 1, IsListedForSale = true, PropertyType = "House" } }, new Models.Offer { Id = 3, PropertyId = 2, Amount = 300000, BuyerUserId = "123", Status = OfferStatus.Accepted, Property = new Models.Property { Id = 2, Description = "Large house", StreetName = "2 Somewhere", NumberOfBedrooms = 8, IsListedForSale = true, PropertyType = "House" } }, new Models.Offer { Id = 4, PropertyId = 2, Amount = 400000, BuyerUserId = "125", Status = OfferStatus.Pending, Property = new Models.Property { Id = 2, Description = "Large house", StreetName = "2 Somewhere", NumberOfBedrooms = 8, IsListedForSale = true, PropertyType = "House" } } }; var mockOfferSet = Substitute.For <IDbSet <Models.Offer> >() .Initialize(offers.AsQueryable()); _context.Offers.Returns(mockOfferSet); }
public AppointmentsOnPropertyViewModelBuilder(IOrangeBricksContext context) { _context = context; }
public AvailableViewingsViewModelBuilder(IOrangeBricksContext context) { _context = context; }
public ViewingAppointmentsController(IOrangeBricksContext context) { _context = context; }
public MakeOfferCommandHandler(IOrangeBricksContext context) { _context = context; }
public CreatePropertyCommandHandler(IOrangeBricksContext context) { this._context = context; }
public MakeViewingAppointmentViewModelBuilder(IOrangeBricksContext context) { _context = context; }
public RejectViewingCommandHandler(IOrangeBricksContext context) { _context = context; }
public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); }
public MakeOfferViewModelBuilder(IOrangeBricksContext context) { _context = context; }
public OffersController(IOrangeBricksContext context) { _context = context; }
public PropertyController(IOrangeBricksContext context) { _context = context; }
public OffersMadeViewModelBuilder(IOrangeBricksContext context) { _context = context; }