public void CopyTo_InvalidIndex_Throws() { ICollection collection = new ServiceNameCollection(new[] { "first", "second" }); int[] destination = new int[collection.Count]; Assert.Throws <ArgumentOutOfRangeException>(() => collection.CopyTo(destination, -1)); Assert.Throws <ArgumentException>(() => collection.CopyTo(destination, destination.Length)); }
public void CopyTo_DestinationTooSmall_Throws() { ICollection collection = new ServiceNameCollection(new[] { "first", "second" }); int[] destination = new int[collection.Count - 1]; Assert.Throws <ArgumentException>(() => collection.CopyTo(destination, 0)); }
public void CopyTo_InvalidDestinationType_Throws() { ICollection collection = new ServiceNameCollection(new[] { "first", "second" }); int[] destination = new int[collection.Count]; Assert.Throws <InvalidCastException>(() => collection.CopyTo(destination, 0)); }
public void CopyTo_ValidDestination_Success() { string[] expected = new[] { "first", "second" }; ICollection collection = new ServiceNameCollection(expected); string[] destination = new string[collection.Count]; collection.CopyTo(destination, 0); Assert.Equal(expected, destination); }
public void CopyTo_NullDestination_Throws() { ICollection collection = new ServiceNameCollection(new[] { "first", "second" }); Assert.Throws <ArgumentNullException>(() => collection.CopyTo(null, 0)); }
public void CopyTo_InvalidDestinationType_Throws() { ICollection collection = new ServiceNameCollection(new[] { "first", "second" }); int[] destination = new int[collection.Count]; Assert.Throws<InvalidCastException>(() => collection.CopyTo(destination, 0)); }
public void CopyTo_InvalidIndex_Throws() { ICollection collection = new ServiceNameCollection(new[] { "first", "second" }); int[] destination = new int[collection.Count]; Assert.Throws<ArgumentOutOfRangeException>(() => collection.CopyTo(destination, -1)); Assert.Throws<ArgumentException>(() => collection.CopyTo(destination, destination.Length)); }
public void CopyTo_DestinationTooSmall_Throws() { ICollection collection = new ServiceNameCollection(new[] { "first", "second" }); int[] destination = new int[collection.Count - 1]; Assert.Throws<ArgumentException>(() => collection.CopyTo(destination, 0)); }
public void CopyTo_NullDestination_Throws() { ICollection collection = new ServiceNameCollection(new[] { "first", "second" }); Assert.Throws<ArgumentNullException>(() => collection.CopyTo(null, 0)); }
public void CopyTo_ValidDestination_Success() { string[] expected = new[] { "first", "second" }; ICollection collection = new ServiceNameCollection(expected); string[] destination = new string[collection.Count]; collection.CopyTo(destination, 0); Assert.Equal(expected, destination); }