public void Setup() { this._dbName = this.GetType().Name + "-" + Guid.NewGuid(); using (var context = new ConferenceRegistrationDbContext(this._dbName)) { if (context.Database.Exists()) { context.Database.Delete(); } context.Database.Create(); } var blobStorage = new MemoryBlobStorage(); this._sut = new DraftOrderViewModelGenerator(() => new ConferenceRegistrationDbContext(_dbName)); this._dao = new OrderDao(() => new ConferenceRegistrationDbContext(_dbName), blobStorage, new JsonTextSerializer()); System.Diagnostics.Trace.Listeners.Clear(); this._orderPlacedEvent = new OrderPlaced { SourceId = Guid.NewGuid(), ConferenceId = Guid.NewGuid(), AccessCode = "asdf", Seats = new[] { new SeatQuantity(Guid.NewGuid(), 5) }, Version = 1 }; _sut.Handle(_orderPlacedEvent); }
public void Setup() { this._dbName = this.GetType().Name + "-" + Guid.NewGuid(); using (var context = new ConferenceRegistrationDbContext(this._dbName)) { if (context.Database.Exists()) { context.Database.Delete(); } context.Database.Create(); } var blobStorage = new MemoryBlobStorage(); this._sut = new PricedOrderViewModelGenerator(() => new ConferenceRegistrationDbContext(_dbName)); this._dao = new OrderDao(() => new ConferenceRegistrationDbContext(_dbName), blobStorage, new JsonTextSerializer()); this._seatCreatedEvents = new[] { new SeatCreated { SourceId = Guid.NewGuid(), Name = "General" }, new SeatCreated { SourceId = Guid.NewGuid(), Name = "Precon" } }; this._sut.Handle(this._seatCreatedEvents[0]); this._sut.Handle(this._seatCreatedEvents[1]); this._orderPlaced = new OrderPlaced { SourceId = _orderId, ReservationAutoExpiration = DateTime.UtcNow.AddMinutes(10), Version = 2, }; this._sut.Handle(_orderPlaced); this._sut.Handle(new OrderTotalsCalculated { SourceId = _orderId, Lines = new[] { new SeatOrderLine { LineTotal = 50, SeatType = this._seatCreatedEvents[0].SourceId, Quantity = 10, UnitPrice = 5 }, }, Total = 50, IsFreeOfCharge = true, Version = 4, }); this._dto = this._dao.FindPricedOrder(_orderId); }
public void Setup() { this._dbName = this.GetType().Name + "-" + Guid.NewGuid(); using (var context = new ConferenceRegistrationDbContext(this._dbName)) { if (context.Database.Exists()) { context.Database.Delete(); } context.Database.Create(); } var conferenceDao = new Mock <IConferenceDao>(); conferenceDao.Setup(x => x.GetSeatTypeNames(It.IsAny <IEnumerable <Guid> >())) .Returns(SeatTypes); var blobs = new MemoryBlobStorage(); this.dao = new OrderDao(() => new ConferenceRegistrationDbContext(_dbName), blobs, new JsonTextSerializer()); this.sut = new SeatAssignmentsViewModelGenerator(conferenceDao.Object, blobs, new JsonTextSerializer()); this.sut.Handle(new SeatAssignmentsCreated { SourceId = AssignmentsId, OrderId = OrderId, Seats = new[] { new SeatAssignmentsCreated.SeatAssignmentInfo { Position = 0, SeatType = SeatTypes[0].Id }, new SeatAssignmentsCreated.SeatAssignmentInfo { Position = 1, SeatType = SeatTypes[1].Id }, } }); }