Beispiel #1
0
        public void GetStudents_Success()
        {
            //Arrange
            People_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.GetStudents(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.People);
            Assert.AreEqual(reply.People.ToString(), "[ { \"personId\": 1, \"name\": \"Jaymes\" }, { \"personId\": 2, \"name\": \"Aaron\" }, { \"personId\": 3, \"name\": \"Benjamyn\" }, { \"personId\": 4, \"name\": \"Cara\" } ]");
        }