xamarin-macios/tests/monotouch-test/Foundation/NetServiceTest.cs

46 строки
991 B
C#
Исходник Обычный вид История

2016-05-26 16:06:52 +03:00
//
// Unit tests for NSNetService
//
// Authors:
// Sebastien Pouliot <sebastien@xamarin.com>
//
// Copyright 2015 Xamarin Inc. All rights reserved.
//
#if !__WATCHOS__
using System;
#if XAMCORE_2_0
using Foundation;
using UIKit;
#else
using MonoTouch.Foundation;
using MonoTouch.UIKit;
#endif
using NUnit.Framework;
namespace MonoTouchFixtures.Foundation {
[TestFixture]
[Preserve (AllMembers = true)]
public class NetServiceTest {
[Test]
public void DefaultCtor ()
{
using (var ns = new NSNetService ("d", "_test._tcp", UIDevice.CurrentDevice.Name, 1234)) {
Assert.That (ns.Domain, Is.EqualTo ("d"), "Domain");
Assert.That (ns.Type, Is.EqualTo ("_test._tcp"), "Type");
Assert.That (ns.Port, Is.EqualTo (1234), "Port");
NSInputStream input;
NSOutputStream output;
Assert.True (ns.GetStreams (out input, out output), "GetStreams");
Assert.NotNull (input, "input");
Assert.NotNull (output, "output");
}
}
}
}
#endif // !__WATCHOS__