Exemplo n.º 1
0
 public void should_send_package_with_data()
 {
     //arrange
     var request = new Request();
     string userName = Guid.NewGuid().ToString();
     string userPassword = Guid.NewGuid().ToString();
     //act
     request.Send(userName + userPassword);
     //assert
     Assert.Pass();
 }
Exemplo n.º 2
0
        public void should_request_send_with_any_string_packet()
        {
            using (StringWriter sw = new StringWriter())
            {
                //arrange
                Console.SetOut(sw);

                var request = new Request(new Random().Next(10));
                int beforeCount = request.GetRequestCount();

                string packet = Guid.NewGuid().ToString();
                string expected = string.Format("Packet data: {0}{1}", packet, Environment.NewLine);

                //act
                request.Send(packet);
                int afterCount = request.GetRequestCount();

                //assert
                Assert.AreEqual(afterCount - beforeCount, 1);
                Assert.AreEqual(expected, sw.ToString());

                //after test
                ConsoleInitialize();
            }
        }