コード例 #1
0
		public void TestRespTimeFormat()
		{
			var svc = new EventfulService(new RestSharpProxy());
			var d = new DateTime(2015, 1, 24, 13, 49, 00);
			var str = d.ToString(svc.EventfulDateTimeResponseFormat);

			Assert.Equal("2015-01-24 13:49:00", str);
        }
コード例 #2
0
		private void TestNumberOfCallsMadeCore(TestData d)
		{
			Console.WriteLine(d.Message);

			var req = new EventfulResponse() { TotalItems = d.Total };

			var mock = new Mock<IRestProxy>();
			// setup total count number
			mock.Setup(p => p.Execute<EventfulResponse>(It.IsAny<RestRequest>()))
				.Returns(req);

			var svc = new EventfulService(mock.Object);
			var tasks = svc.GetEventsAsync(new SearchRequest());

			mock.Verify(p => p.ExecuteAsync<EventfulResponse>(It.IsAny<RestRequest>()), Times.Exactly(d.Times));
		}
コード例 #3
0
		public void TestGetTotal()
		{
			var svc = new EventfulService(new RestSharpProxy());
			var search = new SearchRequest()
			{
				Geocode = "45.6387281,-122.6614861",
				Address = "45.6387281,-122.6614861",
                Category = "Music",
				StartDate = new DateTime(2015, 2, 1),
				EndDate = new DateTime(2015, 2, 1),
				Radius = 1f
			};

			var count = svc.GetEventCount(search);
			Assert.Equal(5, count);
		}