ArrayExtensionsTests Compare Method Delta Engine Documentation

Namespace: DeltaEngine.Tests.Extensions
Assembly: DeltaEngine.Tests (in DeltaEngine.Tests.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public void Compare()
Examples

[Test]
public void Compare()
{
    var numbers1 = new[] { 1, 2, 5 };
    var numbers2 = new[] { 1, 2, 5 };
    var numbers3 = new[] { 1, 2, 5, 7 };
    Assert.IsTrue(numbers1.Compare(numbers2));
    Assert.IsFalse(numbers1.Compare(null));
    Assert.IsFalse(numbers1.Compare(numbers3));
    Assert.IsFalse(numbers3.Compare(numbers1));
    byte[] optionalData = null;
    Assert.IsTrue(optionalData.Compare(null));
}
[Test]
public void Insert()
{
    int[] source = { 1, 2, 4, 5, 6 };
    source = source.Insert(3, 2);
    Assert.True(source.Compare(new[] { 1, 2, 3, 4, 5, 6 }));
    source = source.Insert(0, 0);
    Assert.True(source.Compare(new[] { 0, 1, 2, 3, 4, 5, 6 }));
    source = source.Insert(7, source.Length);
    Assert.True(source.Compare(new[] { 0, 1, 2, 3, 4, 5, 6, 7 }));
}
See Also