Exemplo n.º 1
0
 public static void Main()
 {
     DataCollector dc = new DataCollector();
     dc.Start();
     RegistrationServer rs = new RegistrationServer(dc);
     rs.Start();
 }
        public void Process_NoPortRightAnswer(string receiveMessage, string answerMessage)
        {
            RegistrationServer registrationServer = new RegistrationServer(new DataCollector());
            commMock.Read().Returns(receiveMessage);
            commMock.RemoteIp.Returns(IPAddress.Parse("200.0.0.1"));

            registrationServer.Process(commMock);

            commMock.Received().Write(answerMessage);
        }
        public void Process_AddsRightArtifact()
        {
            IDataCollector dataCollectorMoc = Substitute.For<IDataCollector>();
            RegistrationServer registrationServer = new RegistrationServer(dataCollectorMoc);

            commMock.Read().Returns("action=register id=name port=1234");
            commMock.RemoteIp.Returns(IPAddress.Parse("127.0.0.3"));

            registrationServer.Process(commMock);

            dataCollectorMoc.Received().AddArtifact("name", IPAddress.Parse("127.0.0.3") ,1234);
        }