Esempio n. 1
0
        public void GetActiveProjects_Success()
        {
            //Arrange
            Projects_Reply reply = null;

            //Act
            if (channel == null)
            {
                channel = new Channel("127.0.0.1:50051", ChannelCredentials.Insecure);
                client  = new Greeter.GreeterClient(channel);
            }
            try
            {
                reply = client.GetActiveProjects(new Empty {
                });
                Console.WriteLine($"Reply:\n{reply}");
            }
            catch (Grpc.Core.RpcException ex)
            {
                Console.WriteLine($"ERROR:\n{ex.Message}\nNot connected to service.");
            }
            //Assert
            Assert.IsNotNull(reply.Projects);
            Assert.AreEqual(reply.Projects.ToString(), "[ { \"projectId\": 1, \"name\": \"Unity\", \"active\": \"Y\" }, { \"projectId\": 2, \"name\": \"Blender\", \"active\": \"Y\" }, { \"projectId\": 3, \"name\": \"Typing\", \"active\": \"Y\" }, { \"projectId\": 17, \"name\": \"Prodigy\", \"active\": \"Y\" }, { \"projectId\": 18, \"name\": \"Gaming\", \"active\": \"Y\" }, { \"projectId\": 19, \"name\": \"ASP.NET MVC\", \"active\": \"Y\" }, { \"projectId\": 20, \"name\": \"18 - Gaming\", \"active\": \"Y\" }, { \"projectId\": 21, \"name\": \"gamemaker\", \"active\": \"Y\" }, { \"projectId\": 22, \"name\": \"FreeCodeCamp\", \"active\": \"Y\" }, { \"projectId\": 23, \"name\": \"TestProject\", \"active\": \"Y\" }, { \"projectId\": 24, \"name\": \"Trumpet\", \"active\": \"Y\" }, { \"projectId\": 25, \"name\": \"24 - Trumpet\", \"active\": \"Y\" }, { \"projectId\": 26, \"name\": \"24 - Trumpet\", \"active\": \"Y\" }, { \"projectId\": 27, \"name\": \"Report\", \"active\": \"Y\" }, { \"projectId\": 28, \"name\": \"Report\", \"active\": \"Y\" }, { \"projectId\": 29, \"name\": \"Math\", \"active\": \"Y\" }, { \"projectId\": 30, \"name\": \"Math\", \"active\": \"Y\" } ]");
        }