public void TestGetTokenNormalData()
		{
			var context = new Mock<IScenarioContextHelper>(MockBehavior.Strict);

			var manager = new TokenManager(context.Object);

			var result = manager.GetToken("Test Data");

			Assert.AreEqual("Test Data", result);

			context.VerifyAll();
		}
		public void TestGetTokenIsMalformedTokenData()
		{
			var context = new Mock<IScenarioContextHelper>(MockBehavior.Strict);
			context.Setup(c => c.GetValue<string>("TOKEN:MYTOKEN")).Returns("Token Data");

			var manager = new TokenManager(context.Object);

			var result = manager.GetToken("{ MyToken }");

			Assert.AreEqual("Token Data", result);

			context.VerifyAll();
		}
		public void TestSetTokenKeyAndValueNormalData()
		{
			var context = new Mock<IScenarioContextHelper>(MockBehavior.Strict);
			context.Setup(c => c.SetValue("Test Data", "TOKEN:MYTOKEN"));

			var manager = new TokenManager(context.Object);

			manager.SetToken("MyToken", "Test Data");

			context.VerifyAll();
		}
		public void TestSetTokenIsStringTokenDataCustomLength()
		{
			var context = new Mock<IScenarioContextHelper>(MockBehavior.Strict);
			context.Setup(c => c.SetValue(It.IsAny<string>(), "TOKEN:MYTOKEN"));

			var manager = new TokenManager(context.Object);

			var result = manager.SetToken("{MyToken:randomstring:10}");

			Assert.IsNotNull(result);
			Assert.AreEqual(10, result.Length);

			context.VerifyAll();
		}
		public void TestSetTokenIsGuidTokenData()
		{
			var context = new Mock<IScenarioContextHelper>(MockBehavior.Strict);
			context.Setup(c => c.SetValue(It.IsAny<string>(), "TOKEN:MYTOKEN"));

			var manager = new TokenManager(context.Object);

			var result = manager.SetToken("{MyToken:randomguid}");

			Assert.IsNotNull(result);

			Guid value;
			Assert.IsTrue(Guid.TryParse(result, out value));

			context.VerifyAll();
		}
		public void TestSetTokenIsTokenData()
		{
			var context = new Mock<IScenarioContextHelper>(MockBehavior.Strict);
			context.Setup(c => c.SetValue("Some Data", "TOKEN:MYTOKEN"));

			var manager = new TokenManager(context.Object);

			var result = manager.SetToken("{MyToken:Some Data}");

			Assert.AreEqual("Some Data", result);

			context.VerifyAll();
		}
		public void TestSetTokenNullData()
		{
			var context = new Mock<IScenarioContextHelper>(MockBehavior.Strict);

			var manager = new TokenManager(context.Object);

			var result = manager.SetToken(null);

			Assert.IsNull(result);

			context.VerifyAll();
		}
		public void TestSetTokenKeyAndValueNullKey()
		{
			var context = new Mock<IScenarioContextHelper>(MockBehavior.Strict);
			var manager = new TokenManager(context.Object);

			ExceptionHelper.SetupForException<ArgumentNullException>(
				() => manager.SetToken(null, "Test Data"),
				e =>
					{
						Assert.AreEqual("tokenName", e.ParamName);
						context.VerifyAll();
					});
		}