mirror of
https://github.com/claunia/plist-cil.git
synced 2025-12-16 19:14:26 +00:00
Code refactor and clean-up to follow new C# 9 conventions and features where applicable.
This commit is contained in:
@@ -6,30 +6,30 @@ namespace plistcil.test
|
||||
{
|
||||
public class NSArrayTests
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests the addition of a .NET object to the NSArray
|
||||
/// </summary>
|
||||
/// <summary>Tests the addition of a .NET object to the NSArray</summary>
|
||||
[Fact]
|
||||
public void AddAndContainsObjectTest()
|
||||
{
|
||||
NSArray array = new NSArray();
|
||||
array.Add(1);
|
||||
var array = new NSArray
|
||||
{
|
||||
1
|
||||
};
|
||||
|
||||
Assert.True(array.Contains(1));
|
||||
Assert.False(array.Contains(2));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the <see cref="NSArray.GetEnumerator" /> method.
|
||||
/// </summary>
|
||||
/// <summary>Tests the <see cref="NSArray.GetEnumerator" /> method.</summary>
|
||||
[Fact]
|
||||
public void EnumeratorTest()
|
||||
{
|
||||
NSArray array = new NSArray();
|
||||
array.Add(0);
|
||||
array.Add(1);
|
||||
var array = new NSArray
|
||||
{
|
||||
0,
|
||||
1
|
||||
};
|
||||
|
||||
IEnumerator<NSObject> enumerator = array.GetEnumerator();
|
||||
using IEnumerator<NSObject> enumerator = array.GetEnumerator();
|
||||
|
||||
Assert.Null(enumerator.Current);
|
||||
|
||||
@@ -42,46 +42,46 @@ namespace plistcil.test
|
||||
Assert.False(enumerator.MoveNext());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the <see cref="NSArray.IndexOf(object)" /> method for .NET objects.
|
||||
/// </summary>
|
||||
/// <summary>Tests the <see cref="NSArray.IndexOf(object)" /> method for .NET objects.</summary>
|
||||
[Fact]
|
||||
public void IndexOfTest()
|
||||
{
|
||||
NSArray array = new NSArray();
|
||||
array.Add(1);
|
||||
array.Add("test");
|
||||
var array = new NSArray
|
||||
{
|
||||
1,
|
||||
"test"
|
||||
};
|
||||
|
||||
Assert.Equal(0, array.IndexOf(1));
|
||||
Assert.Equal(1, array.IndexOf("test"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests the <see cref="NSArray.Insert(int, object)" /> method for a
|
||||
/// .NET object.
|
||||
/// </summary>
|
||||
/// <summary>Tests the <see cref="NSArray.Insert(int, object)" /> method for a .NET object.</summary>
|
||||
[Fact]
|
||||
public void InsertTest()
|
||||
{
|
||||
NSArray array = new NSArray();
|
||||
array.Add(0);
|
||||
array.Add(1);
|
||||
array.Add(2);
|
||||
var array = new NSArray
|
||||
{
|
||||
0,
|
||||
1,
|
||||
2
|
||||
};
|
||||
|
||||
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.
|
||||
/// </summary>
|
||||
/// <summary>Tests the <see cref="NSArray.Remove(object)" /> method for a .NET object.</summary>
|
||||
[Fact]
|
||||
public void RemoveTest()
|
||||
{
|
||||
NSArray array = new NSArray();
|
||||
array.Add(0);
|
||||
var array = new NSArray
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
Assert.False(array.Remove((object)1));
|
||||
Assert.True(array.Remove((object)0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user