コード例 #1
0
        public void HasNextIsFalseAfterServerFailure()
        {
            var manager = new SingleServerManager(new ConnectionBuilder("Server=unit-test-1"));

            Assert.True(manager.HasNext, "SingleServerManager was not initialized with a server");
            var server = manager.Next();

            manager.ErrorOccurred(server, new Exception());

            Assert.False(manager.HasNext, "SingleServerManager still has a server after its failure");
        }
コード例 #2
0
		public void HasNextIsFalseAfterServerFailure()
		{

			var manager = new SingleServerManager(new ConnectionBuilder("Server=unit-test-1"));
			
			Assert.True(manager.HasNext, "SingleServerManager was not initialized with a server");
			var server = manager.Next();
			manager.ErrorOccurred(server,new Exception());

			Assert.False(manager.HasNext, "SingleServerManager still has a server after its failure");
		}
コード例 #3
0
        public void CanGetServerAfterError()
        {
            SingleServerManager target = new SingleServerManager(new ConnectionBuilder("Server=unit-test-1"));

            Server original = target.Next();

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

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

                //mark the server as failing to set up the next test iteration.
                target.ErrorOccurred(next);
            }
        }
コード例 #4
0
		public void CanGetServerAfterError()
		{
			SingleServerManager target = new SingleServerManager(new ConnectionBuilder("Server=unit-test-1"));

			Server original = target.Next();

			for (int i = 0; i < 10; i++)
			{
				Assert.True(target.HasNext, "SingleServerManager should always have another server available.");
				
				Server next = target.Next();
				Assert.True(original.ToString().Equals(next.ToString(), StringComparison.OrdinalIgnoreCase), "SingleServerManager always returns the same server.");

				//mark the server as failing to set up the next test iteration.
				target.ErrorOccurred(next);
			}
		}