public void When() { using (var session = OpenSession()) { DateTimeProvider.Now = () => new DateTime(2012, 10, 11); var query = new TweedehandsQuery(Guid.NewGuid(), "VW", "Cars", "*****@*****.**"); query.ChangeStatus(Status.Confirmed); session.Store(query); session.SaveChanges(); _queryId = query.Id; } var proxy = new Mock<IQueryService>(); proxy .Setup(p => p.Query("belgium", "Cars", "VW")) .Returns(new TweedehandsAlert.BackgroundWorker.Query.Proxy.QueryResult() { Items = new List<ResultItem>() { new ResultItem() { DateTime = new ResultItemDateTime() { Value = new DateTime(2012, 10, 10) }, Url = @"http://www.test.be/1" , Title = new ResultTitle() { Value = "Test 1" } }, new ResultItem() { DateTime = new ResultItemDateTime() { Value = new DateTime(2012, 10, 12) }, Url = @"http://www.test.be/2", Title = new ResultTitle() { Value = "Test 2" } } } }); DateTimeProvider.Now = () => new DateTime(2012, 10, 12); var job = new QueryJob(proxy.Object); job.Execute(new Mock<IJobExecutionContext>().Object); }
public void When() { using (var session = OpenSession()) { var query = new TweedehandsQuery(Guid.NewGuid(), "Stratocaster", "Guitar", "*****@*****.**"); session.Store(query); session.SaveChanges(); _queryId = query.Id; _token = query.Token; } Execute(new UnsubscribeFromQueryCommand(_token)); }
public void When() { using (var session = OpenSession()) { DateTimeProvider.Now = () => new DateTime(2012, 10, 11); var query = new TweedehandsQuery(Guid.NewGuid(), "Carzzz", "Category", "*****@*****.**"); query.ChangeStatus(Status.Confirmed); session.Store(query); _querId = query.Id; var queryCollection1 = new QueryResultCollection(query.Id, new List<QueryResult>() { new QueryResult(new DateTime(2010, 10, 10), "Test 1", "http://www.test.be/1"), new QueryResult(new DateTime(2010, 10, 11), "Test 2", "http://www.test.be/2"), }); var queryCollection2 = new QueryResultCollection(query.Id, new List<QueryResult>() { new QueryResult(new DateTime(2010, 10, 12), "Test 3", "http://www.test.be/3"), new QueryResult(new DateTime(2010, 10, 13), "Test 4", "http://www.test.be/4"), }); session.Store(queryCollection1); session.Store(queryCollection2); _collectionId1 = queryCollection1.Id; _collectionId2 = queryCollection2.Id; session.SaveChanges(); } DateTimeProvider.Now = () => new DateTime(2012, 10, 12); _mailGun = new Mock<IMailGun>(); var mailJob = new AlertJob(_mailGun.Object); mailJob.Execute(new Mock<IJobExecutionContext>().Object); }
public void When_initialized_value_is_set() { var query = new TweedehandsQuery(Guid.NewGuid(), "Value", "Category", "*****@*****.**"); Assert.AreEqual("Value", query.Value); }
public void When_initialized_token_is_set() { var query = new TweedehandsQuery(Guid.NewGuid(), "Value", "Category", "*****@*****.**"); Assert.AreNotEqual(Guid.Empty, query.Token); }
public void When_initialized_results_last_queried_timestamp_is_empty() { var query = new TweedehandsQuery(Guid.NewGuid(), "Value", "Category", "*****@*****.**"); Assert.IsNull(query.LastQueriedOn); }
public void When_initialized_emailaddress_is_set() { var query = new TweedehandsQuery(Guid.NewGuid(), "Value", "Category", "*****@*****.**"); Assert.AreEqual("*****@*****.**", query.EmailAddress); }
public void When_initialized_created_on_timestamp_is_set() { var query = new TweedehandsQuery(Guid.NewGuid(), "Value", "Category", "*****@*****.**"); Assert.AreNotEqual(DateTime.MinValue, query.CreatedOn); }
public void When_initialized_confirmation_status_needs_to_be_asked_for_confirmation() { var query = new TweedehandsQuery(Guid.NewGuid(), "Value", "Category", "*****@*****.**"); Assert.AreEqual(Status.NeedsToBeAskedForConfirmation, query.Status); }