public void Create()
        {
            var obj = new ZeroconfHost(null, null);

            Assert.IsNotNull(obj);
            Assert.IsNull(obj.IPAddresses);
            Assert.IsNull(obj.Services);
        }
Ejemplo n.º 2
0
        public LogInPage(ZeroconfHost zeroconfHost)
        {
            InitializeComponent();
            Title = Resource.Home;
            var vm = App.Container.Resolve <LoginPageViewModel>();

            vm.SetHost(zeroconfHost);
            Start(vm);
        }
        public async Task ToQuerySshTest(string displayName, string iPAddress, int port)
        {
            var mockB = new Mock <IService>();

            mockB.SetupAllProperties();
            mockB.Setup(service => service.Port).Returns(port);
            bool called   = false;
            var  callArgs = string.Empty;
            var  mockA    = new Mock <INavigationService>();


            mockA.Setup(x => x.NavigateAsync(It.IsAny <string>(), true))
            .Callback((string s, bool a) => callArgs = s)
            .Returns(() =>
            {
                called = true;
                return(Task.FromResult(true));
            }
                     );


            LocalAutoMock = AutoMock.GetLoose(cfg => cfg.RegisterMock(mockA).Keyed <INavigationService>(NavigationServiceType.ShellNavigation).SingleInstance());
            SetMockContainer();

            var token = new CancellationToken(false);
            var obj   = new ZeroconfHost(new List <string>()
            {
                "_ssh._tcp.local."
            }, new Dictionary <string, IService>()
            {
                { "_ssh._tcp.local.", mockB.Object }
            });

            Assert.IsNotNull(obj);
            obj.IPAddress = iPAddress;
            //obj.Port = port;
            obj.DisplayName = displayName;
            var str = obj.ToQuery();

            Assert.AreEqual($"DisplayNameQuery={displayName}&IPAddressQuery={iPAddress}&PortQuery={port}", str);
        }
        public async Task CallGoToLoginCmd()
        {
            var mockB = new Mock <IService>();

            mockB.SetupAllProperties();
            bool called   = false;
            var  callArgs = string.Empty;
            var  mockA    = new Mock <INavigationService>();


            mockA.Setup(x => x.NavigateAsync(It.IsAny <string>(), true))
            .Callback((string s, bool a) => callArgs = s)
            .Returns(() =>
            {
                called = true;
                return(Task.FromResult(true));
            }
                     );


            LocalAutoMock = AutoMock.GetLoose(cfg => cfg.RegisterMock(mockA).Keyed <INavigationService>(NavigationServiceType.ShellNavigation).SingleInstance());
            SetMockContainer();

            var token = new CancellationToken(false);
            var obj   = new ZeroconfHost(new List <string>()
            {
                "local.net"
            }, new Dictionary <string, IService>()
            {
                { "", mockB.Object }
            });

            Assert.IsNotNull(obj);
            obj.IPAddress = "myhost.net";
            obj.GoToLoginCmd.Execute(null);

            mockA.Verify(x => x.NavigateAsync(It.IsAny <string>(), It.IsAny <object>(), It.IsAny <bool>()), Times.Once);
        }