public void Test_05_ChangingChannelSupportPersistsOnCommit() { CheckedListBox edPolicySupport = new CheckedListBox(); ActionDetailController controller = new ActionDetailController(); controller.PolicySupportControl = edPolicySupport; IResourceAction actionForTest = GetMockActionForTest(); controller.Connect(actionForTest); List<PolicyType> policys = new List<PolicyType>(actionForTest.SupportedPolicySetting); Assert.AreEqual(1, policys.Count, "Should start as ActiveContent and ClientEmail"); Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "Should start as ActiveContent and ClientEmail"); //get first non client email policy in list int id = -1; for (int i = 0; i < edPolicySupport.Items.Count; i++) { if (edPolicySupport.Items[i].ToString() != "Client Email Policy") { id = i; break; } } edPolicySupport.SetItemChecked(id, true); policys = new List<PolicyType>(actionForTest.SupportedPolicySetting); Assert.AreEqual(1, policys.Count, "We haven't committed anything yet"); Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "We haven't committed anything yet"); controller.Commit(); policys = new List<PolicyType>(actionForTest.SupportedPolicySetting); Assert.AreEqual(2, policys.Count, "We haven't committed anything yet"); Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "We added ClientEmail, this should still be here"); }
public void Test_02_ChangingActionNamePersistsOnCommit() { TextBox edActionName = new TextBox(); ActionDetailController controller = new ActionDetailController(); controller.ActionNameControl = edActionName; IResourceAction action = GetMockActionForTest(); controller.Connect(action); Assert.AreEqual("DRMAction", edActionName.Text, "Initial value not as expected."); edActionName.Text = "Digital Rights Management"; Assert.AreEqual("DRMAction", action.Name, "We haven't called commit yet."); controller.Commit(); Assert.AreEqual("Digital Rights Management", action.Name, "Commit failed to persist the action name!."); }
public void Test_01_ConstructionAndSetup() { TextBox edActionName = new TextBox(); CheckedListBox edPolicySupport = new CheckedListBox(); CheckedListBox edFileTypeSupport = new CheckedListBox(); Panel edPropMapPanel = new Panel(); edPropMapPanel.Width = 300; edPropMapPanel.Height = 200; ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); edActionName.Text = "Something"; controller.ActionNameControl = edActionName; Assert.AreEqual("", edActionName.Text, "No value expected for this before connection."); edPolicySupport.Items.Add("Something irrelevant"); controller.PolicySupportControl = edPolicySupport; Assert.AreEqual(0, edPolicySupport.Items.Count, "The controller should initialise the checked list box to empty"); Assert.AreEqual(true, edPolicySupport.CheckOnClick, "Check on click should be set for this item"); edFileTypeSupport.Items.Add("Something silly"); controller.FileTypeSupportControl = edFileTypeSupport; Assert.AreEqual(0, edFileTypeSupport.Items.Count, "The controller should initialise the checked list box to empty"); Assert.AreEqual(true, edFileTypeSupport.CheckOnClick, "Check on click should be set for this item"); edPropMapPanel.Controls.Add(new Panel()); controller.PropertiesControl = edPropMapPanel; Assert.AreEqual(0, edPropMapPanel.Controls.Count, "We should connect to this panel as a clean slate"); Assert.IsTrue(edPropMapPanel.AutoScroll, "In case there are lots of properties"); IResourceAction actionForTest = GetMockActionForTest(); controller.Connect(actionForTest); Assert.AreEqual("DRMAction", edActionName.Text, "The action name field should be populated immediately after connect"); Assert.AreEqual(1, edPolicySupport.CheckedItems.Count, "The mock resource action uses SMTP, HTTP and ActiveContent"); Assert.AreEqual("Client Email Policy", edPolicySupport.Items[edPolicySupport.CheckedIndices[0]], "Only email should be checked"); Assert.AreEqual(3, edFileTypeSupport.Items.Count, "The mock resource supports \".doc (Word Documents)\", \".xls (Excel Spreadsheets)\" and \".ppt (PowerPoint Documents)\""); Assert.AreEqual(".doc (Word Documents)", edFileTypeSupport.Items[0], "These should appear in order"); Assert.AreEqual(".xls (Excel Spreadsheets)", edFileTypeSupport.Items[1], "These should appear in order"); Assert.AreEqual(".ppt (PowerPoint Documents)", edFileTypeSupport.Items[2], "These should appear in order"); Assert.AreEqual(4, edPropMapPanel.Controls.Count, "Controls need to be added; one for each of the 4 ResourceActionProperties in the mock."); }
public void Test_20_TestResourceAction_AutoExpandFirstItem() { ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); IResourceAction action = GetMockActionForTest(); action.AutoExpand = true; CheckBox cb = new CheckBox(); cb.Checked = false; controller.AutoExpandItemControl = cb; controller.Connect(action); Assert.IsTrue(cb.Checked, "After connecting to an action with ExpandFirstFile==true, the checkbox should be checked."); cb.Checked = false; controller.Commit(); Assert.IsFalse(action.AutoExpand, "After un-checking the checkbox and Committing, the action should have ExpandFirstFile==false."); action.AutoExpand = false; controller.Connect(action); Assert.IsFalse(cb.Checked, "After connecting to an action with ExpandFirstFile==false, the checkbox should be un-checked."); cb.Checked = true; controller.Commit(); Assert.IsTrue(action.AutoExpand, "After checking the checkbox and Committing, the action should have ExpandFirstFile==true."); }
public void Test_19_ChangingChannelSupportPersistsOnCommitIfChannelNotDisplayedInUI() { //setup CheckedListBox edPolicySupport = new CheckedListBox(); ActionDetailController controller = new ActionDetailController(); controller.PolicySupportControl = edPolicySupport; IResourceAction actionForTest = GetMockActionForTest(); controller.Connect(actionForTest); Assert.AreEqual(1, edPolicySupport.CheckedIndices.Count, "test setup failure - Incorrect number of items in checked list box"); List<PolicyType> policys = new List<PolicyType>(actionForTest.SupportedPolicySetting); Assert.AreEqual(1, policys.Count, "Should start as ClientEmail"); Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "Should start as ActiveContent and ClientEmail"); //find clientemail id int clientemailid = -1; int otherrandompolicy = 0; for (int i = 0; i < edPolicySupport.Items.Count; i++) { if (edPolicySupport.Items[i].ToString() == "Client Email Policy") { clientemailid = i; break; } } if (clientemailid == 0) otherrandompolicy = 1; edPolicySupport.SetItemChecked(1, true); policys = new List<PolicyType>(actionForTest.SupportedPolicySetting); Assert.AreEqual(1, policys.Count, "We haven't committed anything yet"); Assert.IsTrue(policys.Contains(PolicyType.ClientEmail), "We haven't committed anything yet"); //we'll remove a channel from the checked list box. This is effectively what happens when displaying an action //that supports removeable device channel, if protect mobile is not installed edPolicySupport.Items.RemoveAt(clientemailid); //test controller.Commit(); policys = new List<PolicyType>(actionForTest.SupportedPolicySetting); Assert.AreEqual(1, policys.Count, "Unexpected number of policies in committed action. We only exoect to receive a single supported policy"); Assert.IsFalse(policys.Contains(PolicyType.ClientEmail), "Client email should have dissappeared"); }
public void Test_18_TestResourceAction_AllowTransparentWithBlockingAction() { ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); IResourceAction action = new MockBlockingResourceAction(); CheckBox cb = new CheckBox(); cb.Checked = true; cb.Enabled = true; controller.TransparentSendControl = cb; controller.Connect(action); Assert.IsFalse(cb.Checked, "Checkbox should be automatically unchecked for any blocking action."); Assert.IsFalse(cb.Enabled, "Checkbox should be disabled for any blocking action."); controller.Commit(); Assert.IsFalse(action.AllowTransparent, "Property should always be false for blocking actions."); }
public void Test_17_TestResourceAction_AllowTransparent() { ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); IResourceAction action = GetMockActionForTest(); action.AllowTransparent = true; CheckBox cb = new CheckBox(); cb.Checked = false; controller.TransparentSendControl = cb; controller.Connect(action); Assert.IsTrue( cb.Checked, "After connecting to an action with Transparent==true, the checkbox should be checked."); cb.Checked = false; controller.Commit(); Assert.IsFalse(action.AllowTransparent, "After un-checking the checkbox and Committing, the action should have Transparent==false."); action.AllowTransparent = false; controller.Connect(action); Assert.IsFalse(cb.Checked, "After connecting to an action with Transparent==false, the checkbox should be un-checked."); cb.Checked = true; controller.Commit(); Assert.IsTrue(action.AllowTransparent, "After checking the checkbox and Committing, the action should have Transparent==true."); }
public void Test_16_TestResourceActionPropertyNameValidation() { ActionDetailController actionDetailController = new ActionDetailController(); string errorMessage; //empty name bool validationResult = actionDetailController.ValidateCustomPropertyName(@" ", out errorMessage); Assert.IsFalse(validationResult, "Should not allow empty resource action property names"); Assert.AreEqual(Properties.AdminUIResources.CUSTOMPROPERTY_NAME_BLANK, errorMessage, "incorrect error on empty resource action property names"); //begins with space errorMessage = null; validationResult = actionDetailController.ValidateCustomPropertyName(@" A Property Name", out errorMessage); Assert.IsFalse(validationResult, "Should not allow resource action name beginning with space"); Assert.AreEqual(String.Format(CultureInfo.CurrentCulture, Properties.AdminUIResources.ACTION_NAME_INVALID_CHAR, " ", "1"), errorMessage, "incorrect error on resource action property name beginning with space"); //invalid filename char errorMessage = null; validationResult = actionDetailController.ValidateCustomPropertyName(@"A Property*Name", out errorMessage); Assert.IsFalse(validationResult, "Should not allow resource action name containing special file name chars"); Assert.AreEqual(String.Format(CultureInfo.CurrentCulture, Properties.AdminUIResources.ACTION_NAME_INVALID_CHAR, "*", "11"), errorMessage, "incorrect error on resource action property name containing special file name chars"); //too long errorMessage = null; string name = @"A Property Name that is too long cos there is a limit on exactly how long it can be and for very good reason"; Assert.IsTrue(name.Length > ActionDetailController.PROPERTY_NAME_MAX_LENGTH, "test setup failure - test name is not long enough"); validationResult = actionDetailController.ValidateCustomPropertyName(name, out errorMessage); Assert.IsFalse(validationResult, "Should not allow resource action property name that is too long"); Assert.AreEqual(String.Format(CultureInfo.CurrentCulture, Properties.AdminUIResources.CUSTOMPROPERTY_NAME_INVALID_LENGTH, ActionDetailController.PROPERTY_NAME_MAX_LENGTH.ToString(CultureInfo.CurrentCulture)), errorMessage, "incorrect error on resource action property name that is too long"); //ah... just right errorMessage = null; validationResult = actionDetailController.ValidateCustomPropertyName("A resource action property name", out errorMessage); Assert.IsTrue(validationResult, "Should not complain about this resource action property name"); Assert.AreEqual(string.Empty, errorMessage, "incorrect error on valid resource action property name"); }
public void Test_15_CantDeleteNonExistantProperty() { Panel edPropMapPanel = new Panel(); ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); controller.PropertiesControl = edPropMapPanel; IResourceAction action = GetMockActionForTest(); controller.Connect(action); Assert.AreEqual(4, edPropMapPanel.Controls.Count, "We are expecting 4 controls on the panel"); Label label = GetLabelWithText(edPropMapPanel, "This property does not exist"); Assert.IsNull(label, "This label should not exist!"); Assert.AreEqual(4, action.Properties.Count, "unexpected number of properties on the action"); Assert.IsNull(GetPropertyFromUIByName(edPropMapPanel, "This property does not exist"), "Property should not exist"); try { controller.DeleteCustomProperty("This property does not exist"); Assert.Fail("Failed to throw expected exception"); } catch(Exception ex) { Assert.AreEqual(Properties.AdminUIResources.CUSTOMPROPERTY_NOT_FOUND, ex.Message, "unexpected exception thrown"); } Assert.AreEqual(4, edPropMapPanel.Controls.Count, "We are expecting the controls to remain the same"); label = GetLabelWithText(edPropMapPanel, "This property does not exist"); Assert.IsNull(label, "This label should not exist!"); Assert.AreEqual(4, action.Properties.Count, "unexpected number of properties on the action"); controller.Commit(); Assert.AreEqual(4, action.Properties.Count, "unexpected number of properties on the action"); }
public void Test_07_ChangingPropertyValuePersistsOnCommit() { Panel edPropMapPanel = new Panel(); ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); controller.PropertiesControl = edPropMapPanel; IResourceAction action = GetMockActionForTest(); controller.Connect(action); //boolean property ComboBox combo = GetComboBoxForProperty(edPropMapPanel, "Bool Property"); IResourceActionProperty bigTextProperty = GetPropertyFromActionByName(action, "Bool Property"); combo.SelectedIndex = 1; // Setting for 'false' Assert.AreEqual("False", combo.Text, "Property now mapped to false, but ONLY in UI"); Assert.AreEqual(true, bigTextProperty.Value, "Unexpected value in property before the commit"); controller.Commit(); Assert.AreEqual(false, bigTextProperty.Value, "Failed to map the value to the property after commit"); combo.SelectedIndex = 0; // Setting for 'true' Assert.AreEqual("True", combo.Text, "Property now mapped to true, but ONLY in UI"); Assert.AreEqual(false, bigTextProperty.Value, "Unexpected value in property before the commit"); controller.Commit(); Assert.AreEqual(true, bigTextProperty.Value, "Failed to map the value to the property after commit"); combo.SelectedIndex = 1; // Setting for 'false' Assert.AreEqual("False", combo.Text, "Property now mapped to false, but ONLY in UI"); Assert.AreEqual(true, bigTextProperty.Value, "Unexpected value in property before the commit"); controller.Commit(); Assert.AreEqual(false, bigTextProperty.Value, "Failed to map the value to the property after commit"); //text property TextBox textBox = GetTextBoxForProperty(edPropMapPanel, "Password"); IResourceActionProperty passwordProperty = GetPropertyFromActionByName(action, "Password"); textBox.Text = "MyNewPassword"; Assert.AreEqual("MyNewPassword", textBox.Text, "Property now 'MyNewPassword', but ONLY in UI"); Assert.AreEqual("MyPassword", passwordProperty.Value.ToString(), "Unexpected value in property before commit"); controller.Commit(); Assert.AreEqual("MyNewPassword", passwordProperty.Value.ToString(), "Failed to map the value to the property after commit"); //add custom property controller.CreateCustomProperty("Super Custom"); IResourceActionProperty customProperty = GetPropertyFromActionByName(action, "Super Custom"); Assert.IsNull(customProperty, "Custom property should exist only in the UI"); controller.Commit(); customProperty = GetPropertyFromActionByName(action, "Super Custom"); Assert.IsNotNull(customProperty, "Custom property should have been committed to the collection"); //mapped system property on custom property combo = GetComboBoxForProperty(edPropMapPanel, "Super Custom"); combo.SelectedIndex = 1; //mapped to system property "GroupID (string)" Assert.AreEqual("GroupId (string)", combo.Text, "Property now GroupId (string), but ONLY in UI"); Assert.AreEqual("Undefined", customProperty.Value.ToString(), "Unexpected value in property before commit"); Assert.IsNull(customProperty.MappedSystemProperty, "Unexpected mapped system property before commit"); controller.Commit(); Assert.AreEqual("GroupId (string)", customProperty.Value.ToString(), "Failed to map the value to the property after commit"); Assert.AreEqual("GroupId (string)", customProperty.MappedSystemProperty.PropertyName, "Failed to map the value to the property after commit"); combo.Text = "Free text"; //not mapped to a system property Assert.AreEqual("Free text", combo.Text, "Property now Free text, but ONLY in UI"); Assert.AreEqual("GroupId (string)", customProperty.Value.ToString(), "Unexpected mapped system property before commit"); Assert.AreEqual("GroupId (string)", customProperty.MappedSystemProperty.PropertyName, "Unexpected mapped system property before commit"); controller.Commit(); Assert.AreEqual("Free text", customProperty.Value.ToString(), "Failed to map the value to the property after commit"); Assert.IsNull(customProperty.MappedSystemProperty, "Failed to map the value to the property after commit"); combo.SelectedIndex = 2; //mapped to system property "GroupID (string)" Assert.AreEqual("Recipients (string)", combo.Text, "Property now GroupId (string), but ONLY in UI"); Assert.AreEqual("Free text", customProperty.Value.ToString(), "Unexpected value in property before commit"); Assert.IsNull(customProperty.MappedSystemProperty, "Unexpected mapped system property before commit"); controller.Commit(); Assert.AreEqual("Recipients (string)", customProperty.Value.ToString(), "Failed to map the value to the property after commit"); Assert.AreEqual("Recipients (string)", customProperty.MappedSystemProperty.PropertyName, "Failed to map the value to the property after commit"); }
public void Test_13_DeleteCustomProperty() { Panel edPropMapPanel = new Panel(); ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); controller.PropertiesControl = edPropMapPanel; IResourceAction action = GetMockActionForTest(); controller.Connect(action); controller.CreateCustomProperty("Super Custom"); controller.Commit(); Assert.AreEqual(5, edPropMapPanel.Controls.Count, "We are expecting 5 controls on the panel"); Label label = GetLabelWithText(edPropMapPanel, "Super Custom"); Assert.IsNotNull(label, "This label should now exist!"); Assert.AreEqual(5, action.Properties.Count, "unexpected number of properties on the action"); IResourceActionProperty resourceActionProperty = GetPropertyFromUIByName(edPropMapPanel, "Super Custom"); Assert.IsTrue(action.Properties.Contains(resourceActionProperty), "Resource action property should be in the collection"); ComboBox comboBox = GetComboBoxForProperty(edPropMapPanel, "Super Custom"); Assert.AreEqual(ComboBoxStyle.DropDown, comboBox.DropDownStyle, "Custom properties are string properties"); Assert.AreEqual(3, comboBox.Items.Count, "There should only be the empty property item and system properties 'GroupId & Recipients (string)' here"); Assert.AreEqual("", comboBox.Items[0], "First Item should always be empty"); Assert.AreEqual("GroupId (string)", comboBox.Items[1], "This should be 'GroudId'"); Assert.AreEqual("Recipients (string)", comboBox.Items[2], "This should be 'Recipients'"); controller.DeleteCustomProperty("Super Custom"); Assert.AreEqual(4, edPropMapPanel.Controls.Count, "We are expecting a control to have been removed from the panel"); label = GetLabelWithText(edPropMapPanel, "Super Custom"); Assert.IsNull(label, "This label should not now exist in the UI"); comboBox = GetComboBoxForProperty(edPropMapPanel, "Super Custom"); Assert.IsNull(comboBox, "We are not expecting a combo box for the deleted custom property"); Assert.AreEqual(5, action.Properties.Count, "unexpected number of properties on the action; the property we deleted should still be in the collection as we haven;t committed the change"); Assert.IsTrue(action.Properties.Contains(resourceActionProperty), "Resource action property should still be in the collection as we haven;t yet committed the change"); controller.Commit(); Assert.AreEqual(4, action.Properties.Count, "unexpected number of properties on the action; the property should have been removed from the collection"); Assert.IsFalse(action.Properties.Contains(resourceActionProperty), "Resource action property should have been removed from the collection"); }
public void Test_12_CantAddCustomPropertiesWithSameName_TwoCustom() { Panel edPropMapPanel = new Panel(); ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); controller.PropertiesControl = edPropMapPanel; IResourceAction action = GetMockActionForTest(); controller.Connect(action); controller.CreateCustomProperty("Something"); controller.CreateCustomProperty("Something"); }
public void Test_11_CantAddCustomPropertiesWithSameName_AlreadyExisting() { Panel edPropMapPanel = new Panel(); ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); controller.PropertiesControl = edPropMapPanel; IResourceAction action = GetMockActionForTest(); controller.Connect(action); controller.CreateCustomProperty("Password"); }
public void Test_09_OptionsMapsOnlyToAssociatedType() { Panel edPropMapPanel = new Panel(); ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); controller.PropertiesControl = edPropMapPanel; IResourceAction action = GetMockActionForTest(); controller.Connect(action); ComboBox comboBox = GetComboBoxForProperty(edPropMapPanel, "Encrypt Document"); Assert.AreEqual(ComboBoxStyle.DropDownList, comboBox.DropDownStyle, "Boolean is not text editable"); Assert.AreEqual(2, comboBox.Items.Count, "There should only be the empty property item and system property 'thingy (bool)' here"); Assert.AreEqual("True", comboBox.Items[0], "First Item should always be empty"); Assert.AreEqual("False", comboBox.Items[1], "First Item should always be empty"); TextBox textBox = GetTextBoxForProperty(edPropMapPanel, "password"); Assert.IsNotNull(textBox, "This is a text property, should return a textbox"); Assert.AreEqual("MyPassword", textBox.Text, "Text should be MyPassword"); }
public void Test_08_ConnectingAPropertiesControlRequiresValidResourceManager() { Panel edPropMapPanel = new Panel(); ActionDetailController controller = new ActionDetailController(); controller.PropertiesControl = edPropMapPanel; }
public void Test_14_CantDeleteNonCustomProperty() { Panel edPropMapPanel = new Panel(); ActionDetailController controller = new ActionDetailController(); controller.ResourceManager = new MockResourceManager(); controller.PropertiesControl = edPropMapPanel; IResourceAction action = GetMockActionForTest(); controller.Connect(action); Assert.AreEqual(4, edPropMapPanel.Controls.Count, "We are expecting 4 controls on the panel"); Label label = GetLabelWithText(edPropMapPanel, "Password"); Assert.IsNotNull(label, "This label should now exist!"); TextBox textBox = GetTextBoxForProperty(edPropMapPanel, "Password"); Assert.IsNotNull(textBox, "We are expecting to find a TextBox for the password property"); Assert.AreEqual(4, action.Properties.Count, "unexpected number of properties on the action"); IResourceActionProperty resourceActionProperty = GetPropertyFromUIByName(edPropMapPanel, "Password"); Assert.IsTrue(action.Properties.Contains(resourceActionProperty), "Resource action property should be in the collection"); try { controller.DeleteCustomProperty("Password"); } catch (Exception ex) { Assert.AreEqual(Properties.AdminUIResources.CUSTOMPROPERTY_DELETE_NOTACUSTOMPROPERTY, ex.Message, "Unexpected exception thrown"); } Assert.AreEqual(4, edPropMapPanel.Controls.Count, "We are expecting the controls to remain the same"); label = GetLabelWithText(edPropMapPanel, "Password"); Assert.IsNotNull(label, "This label should still exist in the UI"); textBox = GetTextBoxForProperty(edPropMapPanel, "Password"); Assert.IsNotNull(textBox, "We are expecting to find a TextBox for the password property"); Assert.AreEqual(4, action.Properties.Count, "unexpected number of properties on the action"); Assert.IsTrue(action.Properties.Contains(resourceActionProperty), "Resource action property should be in the collection"); controller.Commit(); Assert.AreEqual(4, action.Properties.Count, "unexpected number of properties on the action"); Assert.IsTrue(action.Properties.Contains(resourceActionProperty), "Resource action property should be in the collection"); }
public void Test_06_ChangingSupportedFileTypesPersistsOnCommit() { CheckedListBox edFileTypeSupport = new CheckedListBox(); ActionDetailController controller = new ActionDetailController(); controller.FileTypeSupportControl = edFileTypeSupport; IResourceAction actionForTest = GetMockActionForTest(); controller.Connect(actionForTest); List<string> files = new List<string>(actionForTest.SupportedFileCollectionSetting.SupportedFiles()); Assert.AreEqual(2, files.Count, "The mock supports .doc and .ppt on creation"); Assert.AreEqual(".doc (Word Documents)", files[0], "Should have .doc as first"); Assert.AreEqual(".ppt (PowerPoint Documents)", files[1], "Should have .ppt as first"); edFileTypeSupport.SetItemChecked(1, true); files = new List<string>(actionForTest.SupportedFileCollectionSetting.SupportedFiles()); Assert.AreEqual(2, files.Count, "We haven't called commit yet"); Assert.AreEqual(".doc (Word Documents)", files[0], "We haven't called commit yet"); Assert.AreEqual(".ppt (PowerPoint Documents)", files[1], "We haven't called commit yet"); controller.Commit(); files = new List<string>(actionForTest.SupportedFileCollectionSetting.SupportedFiles()); Assert.AreEqual(3, files.Count, "Commit should have added .xls"); Assert.AreEqual(".doc (Word Documents)", files[0], "We added .xls, .doc should still be here"); Assert.AreEqual(".xls (Excel Spreadsheets)", files[1], "Commit should have added .xls"); Assert.AreEqual(".ppt (PowerPoint Documents)", files[2], "We added .xls, .ppt should still be here"); }