public void Add_Remove_ByIndex_Success() { FacilityOverrideCollection c = new FacilityOverrideCollection(); FacilityOverrideElement e = new FacilityOverrideElement() { AssemblyName = TestAssembly, Identifier = 42 }; c.Add(e); Assert.AreEqual(0, c.IndexOf(e)); c.RemoveAt(0); Assert.AreEqual(-1, c.IndexOf(e)); }
public void Add_Remove_ByName_Success() { FacilityOverrideCollection c = new FacilityOverrideCollection(); FacilityOverrideElement e = new FacilityOverrideElement() { AssemblyName = TestAssembly, Identifier = 42 }; c.Add(e); Assert.IsNotNull(c[TestAssembly]); c.Remove(TestAssembly); Assert.IsNull(c[TestAssembly]); }
public void Clear_Success() { FacilityOverrideCollection c = new FacilityOverrideCollection(); FacilityOverrideElement e = new FacilityOverrideElement() { AssemblyName = TestAssembly, Identifier = 42 }; c.Add(e); c[0] = e; Assert.AreEqual(0, c.IndexOf(e)); c.Clear(); Assert.AreEqual(-1, c.IndexOf(e)); }
public void ToOverride_Success() { AssemblyName name = typeof(FacilityOverrideElement).Assembly.GetName(); FacilityOverrideElement foe = new FacilityOverrideElement(); foe.AssemblyName = name.FullName; foe.Identifier = 42; FacilityOverride fo = foe.ToOverride(); Assert.AreEqual(name.FullName, fo.AssemblyName.FullName); Assert.AreEqual(42, fo.Identifier); }
public void ToOverride_IdentifierInvalid_Throw() { CustomAssert.ThrowsException<CodedFormatException>(() => { AssemblyName name = typeof(FacilityOverrideElement).Assembly.GetName(); FacilityOverrideElement foe = new FacilityOverrideElement(); foe.AssemblyName = name.FullName; foe.Identifier = -1; FacilityOverride fo = foe.ToOverride(); }); }
public void IsReadOnly_Success() { FacilityOverrideElement foe = new FacilityOverrideElement(); Assert.IsFalse(foe.IsReadOnly); }
/// <summary> /// Gets the index of the specified <see cref="FacilityOverrideElement"/> in the collection. /// </summary> /// <param name="element">The <see cref="FacilityOverrideElement"/> for the specified index location.</param> /// <returns>The index of the specified <see cref="FacilityOverrideElement"/>, if found; otherwise, -1;</returns> public int IndexOf(FacilityOverrideElement element) { return BaseIndexOf(element); }
/// <summary> /// Adds the specified <see cref="FacilityOverrideElement"/> to the collection. /// </summary> /// <param name="element">The <see cref="FacilityOverrideElement"/> to add.</param> public void Add(FacilityOverrideElement element) { BaseAdd(element); }
/// <summary> /// Removes the specified <see cref="FacilityOverrideElement"/> from the collection. /// </summary> /// <param name="element">The <see cref="FacilityOverrideElement"/> to remove.</param> public void Remove(FacilityOverrideElement element) { if (BaseIndexOf(element) != -1) BaseRemove(element.AssemblyName); }