ToString() 공개 메소드

public ToString ( ) : string
리턴 string
        public void CanGetServerAfterError()
        {
            var target = new InfallibleSingleServerManager(new ConnectionBuilder("Server=unit-test-1"));

            var original = target.Next();

            for (int i = 0; i < 10; i++)
            {
                Assert.True(target.HasNext, "InfallibleSingleServerManager should always have another server available.");

                Server next = target.Next();
                Assert.True(original.ToString().Equals(next.ToString(), StringComparison.OrdinalIgnoreCase), "InfallibleSingleServerManager always returns the same server.");

                //mark the server as failing to set up the next test iteration.
                target.ErrorOccurred(next);
            }
        }
예제 #2
0
        public void CanBlackListAndCleanQueueTest()
        {
            RoundRobinServerManager target = new RoundRobinServerManager(new ConnectionBuilder("Server=unit-test-1,unit-test-2,unit-test-3"));

            Server srv = new Server("unit-test-4");

            target.Add(srv);

            bool gotServer4 = false;

            for (int i = 0; i < 4; i++)
            {
                Server server = target.Next();
                if (server.ToString().Equals(srv.ToString(), StringComparison.OrdinalIgnoreCase))
                {
                    gotServer4 = true;
                    break;
                }
            }

            Assert.True(gotServer4);

            target.ErrorOccurred(srv);

            gotServer4 = false;
            for (int i = 0; i < 4; i++)
            {
                Server server = target.Next();
                if (server.Equals(srv))
                {
                    gotServer4 = true;
                    break;
                }
            }

            Assert.False(gotServer4);
        }
예제 #3
0
        public void HasNextWithMoreThanHalfBlacklistedTest()
        {
            RoundRobinServerManager target = new RoundRobinServerManager(new ConnectionBuilder("Server=unit-test-1"));

            Server srv1 = null;
            Server srv2 = new Server("unit-test-2");
            Server srv3 = new Server("unit-test-3");
            Server srv4 = new Server("unit-test-4");

            target.Add(srv2);
            target.Add(srv3);
            target.Add(srv4);
            List <Server> servers = new List <Server> {
                new Server("unit-test-1"), srv2, srv3, srv4
            };

            for (int i = 0; i < 4; i++)
            {
                Server srv = target.Next();
                Assert.True(servers[i].ToString().Equals(srv.ToString(), StringComparison.OrdinalIgnoreCase));
                if (i == 0)
                {
                    srv1 = srv;
                }
            }

            target.ErrorOccurred(srv2);
            target.ErrorOccurred(srv3);
            Assert.True(target.HasNext);

            target.ErrorOccurred(srv1);
            Assert.True(target.HasNext);

            target.ErrorOccurred(srv4);
            Assert.False(target.HasNext);
        }
		public void CanBlackListAndCleanQueueTest()
		{
			RoundRobinServerManager target = new RoundRobinServerManager(new ConnectionBuilder("Server=unit-test-1,unit-test-2,unit-test-3"));

			Server srv = new Server("unit-test-4");
			target.Add(srv);

			bool gotServer4 = false;

			for (int i = 0; i < 4; i++)
			{
				Server server = target.Next();
				if (server.ToString().Equals(srv.ToString(), StringComparison.OrdinalIgnoreCase))
				{
					gotServer4 = true;
					break;
				}
			}

			Assert.True(gotServer4);

			target.ErrorOccurred(srv);

			gotServer4 = false;
			for (int i = 0; i < 4; i++)
			{
				Server server = target.Next();
				if (server.Equals(srv))
				{
					gotServer4 = true;
					break;
				}
			}

			Assert.False(gotServer4);
		}