[Foundation] Add not bound NSDateComponentUndefined. Fixes 60740 (#3471)
Added the value and provided tests that show the API usage. Value was inferred from the headers: NSDateComponentUndefined = NSIntegerMax
This commit is contained in:
Родитель
1ae3156da1
Коммит
7472c8237d
|
@ -0,0 +1,7 @@
|
|||
using System;
|
||||
|
||||
namespace Foundation {
|
||||
public partial class NSDateComponents {
|
||||
public static readonly nint Undefined = nint.MaxValue;
|
||||
}
|
||||
}
|
|
@ -658,6 +658,7 @@ FOUNDATION_CORE_SOURCES = \
|
|||
Foundation/NSAttributedString.iOS.cs \
|
||||
Foundation/EnumDesktop.cs \
|
||||
Foundation/NSObject.mac.cs \
|
||||
Foundation/NSDateComponents.cs \
|
||||
|
||||
FOUNDATION_SOURCES = \
|
||||
Foundation/Additions.cs \
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
#if XAMCORE_2_0
|
||||
using Foundation;
|
||||
#else
|
||||
using MonoTouch.Foundation;
|
||||
using MonoTouch.ObjCRuntime;
|
||||
#endif
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTouchFixtures.Foundation {
|
||||
|
||||
[TestFixture]
|
||||
[Preserve (AllMembers = true)]
|
||||
public class NSDateComponentsTest {
|
||||
|
||||
[Test]
|
||||
public void TestUndefinedComponent ()
|
||||
{
|
||||
// as per documentation:
|
||||
// "When a new instance of NSDateComponents is created,
|
||||
// the date components are set to
|
||||
// NSDateComponentUndefined."
|
||||
// we simply test that the values are undefined
|
||||
var components = new NSDateComponents ();
|
||||
Assert.AreEqual (NSDateComponents.Undefined, components.Year, $"Year");
|
||||
Assert.AreEqual (NSDateComponents.Undefined, components.Month, "Month");
|
||||
Assert.AreEqual (NSDateComponents.Undefined, components.Day, "Day");
|
||||
Assert.AreEqual (NSDateComponents.Undefined, components.Hour, "Hour");
|
||||
Assert.AreEqual (NSDateComponents.Undefined, components.Minute, "Minute");
|
||||
Assert.AreEqual (NSDateComponents.Undefined, components.Second, "Second");
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче