public void HandleCallsEventsByPostalCodeWithCorrectPostalCodeAndDistance() { var message = new EventsByPostalCodeQuery { PostalCode = "PostalCode", Distance = 100 }; var dataStore = new Mock<IAllReadyDataAccess>(); var sut = new EventsByPostalCodeQueryHandler(dataStore.Object); sut.Handle(message); dataStore.Verify(x => x.EventsByPostalCode(message.PostalCode, message.Distance), Times.Once); }
public void HandleCallsEventsByPostalCodeWithCorrectPostalCodeAndDistance() { var message = new EventsByPostalCodeQuery { PostalCode = "PostalCode", Distance = 100 }; var dataStore = new Mock <IAllReadyDataAccess>(); var sut = new EventsByPostalCodeQueryHandler(dataStore.Object); sut.Handle(message); dataStore.Verify(x => x.EventsByPostalCode(message.PostalCode, message.Distance), Times.Once); }
public async Task HandleCallsEventsByPostalCodeWithCorrectPostalCodeAndDistance() { var options = this.CreateNewContextOptions(); var message = new EventsByPostalCodeQuery { PostalCode = "PostalCode", Distance = 100 }; using (var context = new AllReadyContext(options)) { context.Events.Add(new Event()); context.Events.Add(new Event()); await context.SaveChangesAsync(); } using (var context = new AllReadyContext(options)) { var sut = new EventsByPostalCodeQueryHandler(context); var events = sut.Handle(message); Assert.Equal(events.Count, 2); } }