mirror of
https://github.com/claunia/plist-cil.git
synced 2025-12-16 19:14:26 +00:00
Code cleanup and refactor.
This commit is contained in:
@@ -1,17 +1,13 @@
|
||||
using Claunia.PropertyList;
|
||||
using System.Collections.Generic;
|
||||
using Claunia.PropertyList;
|
||||
using Xunit;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace plistcil.test
|
||||
{
|
||||
public class NSArrayTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests the addition of a .NET object to the NSArray
|
||||
/// Tests the addition of a .NET object to the NSArray
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void AddAndContainsObjectTest()
|
||||
@@ -24,7 +20,30 @@ namespace plistcil.test
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the <see cref="NSArray.IndexOf(object)"/> method for .NET objects.
|
||||
/// Tests the <see cref="NSArray.GetEnumerator" /> method.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EnumeratorTest()
|
||||
{
|
||||
NSArray array = new NSArray();
|
||||
array.Add(0);
|
||||
array.Add(1);
|
||||
|
||||
IEnumerator<NSObject> enumerator = array.GetEnumerator();
|
||||
|
||||
Assert.Null(enumerator.Current);
|
||||
|
||||
Assert.True(enumerator.MoveNext());
|
||||
Assert.Equal(new NSNumber(0), enumerator.Current);
|
||||
|
||||
Assert.True(enumerator.MoveNext());
|
||||
Assert.Equal(new NSNumber(1), enumerator.Current);
|
||||
|
||||
Assert.False(enumerator.MoveNext());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the <see cref="NSArray.IndexOf(object)" /> method for .NET objects.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void IndexOfTest()
|
||||
@@ -38,8 +57,8 @@ namespace plistcil.test
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the <see cref="NSArray.Insert(int, object)"/> method for a
|
||||
/// .NET object.
|
||||
/// Tests the <see cref="NSArray.Insert(int, object)" /> method for a
|
||||
/// .NET object.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void InsertTest()
|
||||
@@ -51,12 +70,12 @@ namespace plistcil.test
|
||||
|
||||
array.Insert(1, "test");
|
||||
|
||||
Assert.Equal(4, array.Count);
|
||||
Assert.Equal(4, array.Count);
|
||||
Assert.Equal("test", array[1].ToObject());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the <see cref="NSArray.Remove(object)"/> method for a .NET object.
|
||||
/// Tests the <see cref="NSArray.Remove(object)" /> method for a .NET object.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void RemoveTest()
|
||||
@@ -68,28 +87,5 @@ namespace plistcil.test
|
||||
|
||||
Assert.Empty(array);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the <see cref="NSArray.GetEnumerator"/> method.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EnumeratorTest()
|
||||
{
|
||||
NSArray array = new NSArray();
|
||||
array.Add(0);
|
||||
array.Add(1);
|
||||
|
||||
var enumerator = array.GetEnumerator();
|
||||
|
||||
Assert.Null(enumerator.Current);
|
||||
|
||||
Assert.True(enumerator.MoveNext());
|
||||
Assert.Equal(new NSNumber(0), enumerator.Current);
|
||||
|
||||
Assert.True(enumerator.MoveNext());
|
||||
Assert.Equal(new NSNumber(1), enumerator.Current);
|
||||
|
||||
Assert.False(enumerator.MoveNext());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user