public void TestPropertyDefaults()
		{
			var action = new SkyDoxSendLinkAction();

			// Validate the property defaults are as expected.
			Assert.AreEqual("0", action.PropertySet["ExpiryDays"].Value, "The expires in days property should be 0 by default.");
			Assert.IsTrue((bool) action.PropertySet["GetReturnReceipt"].Value, "The permission's value should be in it's default state.");
			Assert.IsTrue((bool) action.PropertySet["CanComment"].Value, "The permission's value should be in it's default state.");
            Assert.IsFalse((bool)action.PropertySet["CanOnlyAccessIfLoggedIn"].Value, "The permission's value should be in it's default state.");
            Assert.IsTrue((bool)action.PropertySet["CanInviteOthers"].Value, "The permission's value should be in it's default state.");
		}
Пример #2
0
		public void TestFolderOptionsPropertyDefaults()
		{
			var action = new SkyDoxSendLinkAction();

			// Check all properties are in their default state.
			foreach (Tuple<string, object> tuple in folderOptionsPropertyDefaults)
			{
				string name = tuple.Item1;
				object defaultState = tuple.Item2;

				Assert.AreEqual(defaultState, action.PropertySet[name].Value, "The property's value should be it's default.");
			}
		}
Пример #3
0
		public void TestGetPropertyValue()
		{
			var action = new SkyDoxSendLinkAction();

			// Change the default name (long name) of the properties to the key name (short name).
			IEnumerable<IActionProperty> actionProperties =
				from pair in action.PropertySet
				let prop = pair.Value
				select new ActionProperty(pair.Key, prop.DataType, prop.DisplayType, prop.Visible, prop.Override, prop.Value, prop.ReadOnly);

			foreach (Tuple<string, object> tuple in folderOptionsPropertyDefaults)
			{
				string propertyName = tuple.Item1;

				// Get the value of the property.
				string propertyValue = MockStorageLinks.GetPropertyValue(actionProperties, propertyName);

				// The property should have been found.
				Assert.IsNotNullOrEmpty(propertyValue, string.Format("Unable to retrieve the \"{0}\" property.", propertyName));
			}
		}
Пример #4
0
		public void TestGetPermissionFlags_NoNewOnes()
		{
			var action = new SkyDoxSendLinkAction();

			// Change the default name (long name) of the properties to the key name (short name).
			IEnumerable<IActionProperty> actionProperties =
				from pair in action.PropertySet
				let prop = pair.Value
				where prop.DataType == typeof(bool)
				select new ActionProperty(pair.Key, prop.DataType, prop.DisplayType, prop.Visible, prop.Override, true, prop.ReadOnly);

			// Call the GetPermissionFlags() method.
			PermissionFlags flags = MockStorageLinks.GetPermissionFlags(actionProperties.ToList());

			// Make sure there aren't other flags that have been missed.
			PermissionFlags allFlags = PermissionFlags.NoPermissions;
			foreach (Tuple<string, bool> tuple in permissionFlagsPropertyDefaults)
			{
				string name = tuple.Item1;

				PermissionFlags thisFlag;
				Assert.IsTrue(PermissionFlags.TryParse(name, out thisFlag), string.Format("Couldn't parse \"{0}\" as a permission flag.", name));
				allFlags |= thisFlag;
			}
			Assert.IsTrue(flags == allFlags, "The GetPermissionFlags() method returned more flags than this test knows about.");
		}
Пример #5
0
		public void TestGetPermissionFlags_AllExist()
		{
			var action = new SkyDoxSendLinkAction();

			// Change the default name (long name) of the properties to the key name (short name).
			IEnumerable<IActionProperty> actionProperties =
				from pair in action.PropertySet
				let prop = pair.Value
				select new ActionProperty(pair.Key, prop.DataType, prop.DisplayType, prop.Visible, prop.Override, prop.Value, prop.ReadOnly);

			// Call the GetPermissionFlags() method.
			PermissionFlags flags = MockStorageLinks.GetPermissionFlags(actionProperties.ToList());

			// Check that GetPermissionFlags() reads all the flags.
			foreach (Tuple<string, bool> tuple in permissionFlagsPropertyDefaults)
			{
				string name = tuple.Item1;
				bool defaultState = tuple.Item2;

				PermissionFlags thisFlag;
				Assert.IsTrue(PermissionFlags.TryParse(name, out thisFlag), string.Format("Couldn't parse \"{0}\" as a permission flag.", name));
				Assert.IsFalse(defaultState ^ flags.HasFlag(thisFlag), string.Format("The GetPermissionFlags() method did not find the \"{0}\" property.", name));
			}
		}
Пример #6
0
		public void TestPermissionFlagsPropertyDefaults()
		{
			var action = new SkyDoxSendLinkAction();

			// Check all permissions are in their default state.
			foreach (Tuple<string, bool> tuple in permissionFlagsPropertyDefaults)
			{
				string name = tuple.Item1;
				bool defaultState = tuple.Item2;

				Assert.AreEqual(defaultState, (bool) action.PropertySet[name].Value, "The permission's value should be it's default.");
			}
		}