public void DoNotSetOriginToHostServerNameIfAlreadySet()
            {
                var hostAddress = GetHostAddress();
                var messageFactory = new ServiceMessageFactory();
                var message = messageFactory.Create(new[] { new Header(Header.RemoteAddress, IPAddress.None.ToString(), checkReservedNames: false) }, new Object());

                Assert.NotEqual(hostAddress, message.Headers.GetRemoteAddress());
            }
Esempio n. 2
0
            public void DoNotSetOriginToHostServerNameIfAlreadySet()
            {
                var hostAddress    = GetHostAddress();
                var messageFactory = new ServiceMessageFactory();
                var message        = messageFactory.Create(new[] { new Header(Header.RemoteAddress, IPAddress.None.ToString(), checkReservedNames: false) }, new Object());

                Assert.NotEqual(hostAddress, message.Headers.GetRemoteAddress());
            }
            public void SetRemoteAddressToHostServerNameIfNotAlreadySet()
            {
                var hostAddress = GetHostAddress();
                var messageFactory = new ServiceMessageFactory();
                var message = messageFactory.Create(HeaderCollection.Empty, new Object());

                Assert.Equal(hostAddress, message.Headers.GetRemoteAddress());
            }
Esempio n. 4
0
            public void SetRemoteAddressToHostServerNameIfNotAlreadySet()
            {
                var hostAddress    = GetHostAddress();
                var messageFactory = new ServiceMessageFactory();
                var message        = messageFactory.Create(HeaderCollection.Empty, new Object());

                Assert.Equal(hostAddress, message.Headers.GetRemoteAddress());
            }
            public void DoNotSetUserNameIfThreadPrincipalIsNull()
            {
                Thread.CurrentPrincipal = null;

                var messageFactory = new ServiceMessageFactory();
                var message = messageFactory.Create(HeaderCollection.Empty, new Object());

                Assert.Equal(String.Empty, message.Headers.GetUserName());
            }
            public void DoNotSetUserNameToThreadPrincipalIdentityNameIfAlreadySet()
            {
                Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("*****@*****.**"), new String[0]);

                var messageFactory = new ServiceMessageFactory();
                var message = messageFactory.Create(new[] { new Header(Header.UserName, "*****@*****.**", checkReservedNames: false) }, new Object());

                Assert.NotEqual("*****@*****.**", message.Headers.GetUserName());
            }
            public void SetUserNameToThreadPrincipalIdentityNameIfNotAlreadySet()
            {
                Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("*****@*****.**"), new String[0]);

                var messageFactory = new ServiceMessageFactory();
                var message = messageFactory.Create(HeaderCollection.Empty, new Object());

                Assert.Equal("*****@*****.**", message.Headers.GetUserName());
            }
Esempio n. 8
0
            public void DoNotSetUserNameIfThreadPrincipalIsNull()
            {
                Thread.CurrentPrincipal = null;

                var messageFactory = new ServiceMessageFactory();
                var message        = messageFactory.Create(HeaderCollection.Empty, new Object());

                Assert.Equal(String.Empty, message.Headers.GetUserName());
            }
Esempio n. 9
0
            public void DoNotSetUserNameToThreadPrincipalIdentityNameIfAlreadySet()
            {
                Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("*****@*****.**"), new String[0]);

                var messageFactory = new ServiceMessageFactory();
                var message        = messageFactory.Create(new[] { new Header(Header.UserName, "*****@*****.**", checkReservedNames: false) }, new Object());

                Assert.NotEqual("*****@*****.**", message.Headers.GetUserName());
            }
Esempio n. 10
0
            public void SetUserNameToThreadPrincipalIdentityNameIfNotAlreadySet()
            {
                Thread.CurrentPrincipal = new GenericPrincipal(new GenericIdentity("*****@*****.**"), new String[0]);

                var messageFactory = new ServiceMessageFactory();
                var message        = messageFactory.Create(HeaderCollection.Empty, new Object());

                Assert.Equal("*****@*****.**", message.Headers.GetUserName());
            }
Esempio n. 11
0
        private async Task <Tuple <GameDefinition, IServiceMessage> > SelectGame()
        {
            var getGamesRequest = ServiceMessageFactory <GetGamesRequest> .Create();

            var getGamesResponse = await gameManager.GetGamesAsync(getGamesRequest);

            while (true)
            {
                Console.WriteLine("Select a game to play.");
                var idx = 1;
                foreach (var gameDefinition in getGamesResponse.GameDefinitions)
                {
                    Console.WriteLine($"[{idx++}] {gameDefinition.Name}");
                }

                var input = ConsoleHelper.GetIntegerInput();
                if (input > 0 && input <= getGamesResponse.GameDefinitions.Length)
                {
                    return(new Tuple <GameDefinition, IServiceMessage>(getGamesResponse.GameDefinitions[input - 1], getGamesRequest));
                }
                Console.WriteLine($"Invalid input ({input}){Environment.NewLine}");
            }
        }