public void ItShouldBePossibleToInvalidateItem()
		{
			var target = new NodeCache(_runner,TimeSpan.FromSeconds(10));
			target.AddItem("testId", "testValue");
			target.Execute().Count();

			target.InvalidateItem("testId");
			target.Execute().Count();

			Assert.IsFalse(target.GetItems("").ContainsKey("testId"));
		}
		public void ItShouldBePossibleToAddAndGetAnAlreadyExistingItem()
		{
			_loadDataCalled = 0;
			object result = null;
			var target = new NodeCache(_runner,TimeSpan.FromSeconds(10));
			target.AddItem("test", "RESULT");
			_runner.StartCoroutine(new NodeCacheCoroutine(target));
			_runner.RunCycle();		//Initialize node cache coroutine

			var waiter = (FluentResultBuilder)target.AddAndGet(new CacheDefinition
			{
				Id = "test",
				LoadData = () => LoadData(5),
				ExpireAfter = TimeSpan.FromMinutes(1)
			}, (r) =>
			{
				result = r;
			});
			_runner.StartCoroutine(waiter.AsCoroutine());
			//target.Execute().Count();	//Initialize 
			_runner.RunCycle();

			Assert.AreEqual("RESULT", result);
			Assert.AreEqual(0, _loadDataCalled);
		}
		public void ItShouldBePossibleToAddUpdateItemDuplicateShouldUpdateCd()
		{
			var target = new NodeCache(_runner,TimeSpan.FromSeconds(10));
			target.AddItem(new CacheDefinition
			{
				Value = "testValue",
				Id = "testId"
			});
			target.Execute().Count();


			target.AddOrUpdateItem(new CacheDefinition
			{
				Value = "testValueDifferent",
				Id = "testId"
			});
			target.Execute().Count();

			var item = target.GetItems("")["testId"];
			Assert.AreEqual("testValueDifferent", item.Value);
		}
		public void ItShouldBePossibleToAddUpdateItemDuplicateShouldUpdate()
		{
			var target = new NodeCache(_runner,TimeSpan.FromSeconds(10));
			target.AddItem("testId", "testValue");
			target.Execute().Count();

			target.AddOrUpdateItem("testId", "testValueChange");
			target.Execute().Count();

			var item = target.GetItems("")["testId"];
			Assert.AreEqual("testValueChange", item.Value);
		}
		public void ItShouldBePossibleToAddItemWithCd()
		{
			var target = new NodeCache(_runner,TimeSpan.FromSeconds(10));
			target.AddItem(new CacheDefinition
				{
					Value = "testValue",
					Id = "testId"
				});
			target.Execute().Count();

			var group = target.Groups[string.Empty];
			Assert.IsTrue(target.GetItems("").ContainsKey("testId"));
			var item = target.GetItems("")["testId"];
			Assert.AreEqual(group.ExpireAfter, item.ExpireAfter);
			Assert.AreEqual("testValue", item.Value);
			Assert.IsFalse(target.Groups.ContainsKey("test"));
		}
		public void ItShouldBePossibleToAddItemToDefaultGroup()
		{
			var target = new NodeCache(_runner,TimeSpan.FromSeconds(10));
			target.AddItem("testId", "testValue");
			target.Execute().Count();

			var group = target.Groups[string.Empty];
			Assert.IsTrue(target.GetItems("").ContainsKey("testId"));
			var item = target.GetItems("")["testId"];
			Assert.AreEqual(group.ExpireAfter, item.ExpireAfter);
			Assert.AreEqual("testValue", item.Value);
		}
		public void ItShouldBePossibleToAddItemToSpecificGroup()
		{
			var target = new NodeCache(_runner,TimeSpan.FromSeconds(10));
			target.AddGroup(new CacheGroupDefinition
			{
				Id = "testGroup",
				Capped = 1000,
				ExpireAfter = TimeSpan.FromMilliseconds(500),
				RollingExpiration = true
			});
			target.Execute().Count();
			target.AddItem("testId", "testValue", "testGroup");
			target.Execute().Count();

			var group = target.Groups["testGroup"];
			Assert.IsTrue(target.GetItems("testGroup").ContainsKey("testId"));
			var item = target.GetItems("testGroup")["testId"];
			Assert.AreEqual(group.ExpireAfter, item.ExpireAfter);
			Assert.AreEqual("testValue", item.Value);
		}