示例#1
0
 public void SedirServerShouldBeCreatedAsSingleNode()
 {
     using TestableSedirServer server            = TestableSedirServer.Create();
     server.Configuration.Object.NodeRunningPort = 6665;
     server.Run();
     Assert.IsTrue(server.IsRunning);
 }
示例#2
0
        public void SedirServerRunShouldCallTransportationRun()
        {
            Mock <IRunnableSedirTransportationProtocol> handler = new Mock <IRunnableSedirTransportationProtocol>();
            Mock <ServerConfiguration> config = new Mock <ServerConfiguration>();

            handler.Setup(x => x.Run());
            TestableSedirServer sedirServer = new TestableSedirServer(handler, config);

            sedirServer.Run();
            handler.Verify(x => x.Run(), Times.Once);
        }
示例#3
0
        public void SedirServerBuildShouldCallTransportationBuild()
        {
            Mock <IRunnableSedirTransportationProtocol> handler = new Mock <IRunnableSedirTransportationProtocol>();
            Mock <ServerConfiguration> config = new Mock <ServerConfiguration>();

            handler.Setup(x => x.Build(It.IsAny <int>()));
            TestableSedirServer sedirServer = new TestableSedirServer(handler, config);

            sedirServer.Build();
            handler.Verify(x => x.Build(It.IsAny <int>()), Times.Once);
        }
示例#4
0
        public void SedirServerShouldBeStoppedAfterDisposing()
        {
            IRunnableSedirServer server;

            using (server = TestableSedirServer.Create())
            {
                server.Run();
            }

            Assert.IsFalse(server.IsRunning);
        }
示例#5
0
        public void NewSedirServerShouldBeAddedToClusterAsANodeWhenExistingNodeUrlIsGiven()
        {
            var handler = new Mock <IRunnableSedirTransportationProtocol>();
            Mock <ServerConfiguration> config = new Mock <ServerConfiguration>();

            config.Object.OtherNodeUrls = new[]
            { "127.0.0.1:6665" };

            TestableSedirServer server = new TestableSedirServer(handler, config);

            server.Configuration = config;
            Assert.AreEqual(server.Role, NodeRole.Node);
        }
示例#6
0
        public void SedirServerShouldBeLeaderIfConfigurationIsNotGiven()
        {
            TestableSedirServer server = TestableSedirServer.Create();

            Assert.AreEqual(server.Role, NodeRole.Leader);
        }