public void NetworkProtocolCreateResponseSimpleTest() { // arrange // is the date valid bool isValid = true; // count of passing this data short passing = 1; // the unique id of packet long uid = 123; // the length of incoming json data. int receivedMessageLength = 4; // the datetime create from DateTime dt = DateTime.Now; // act string result = NetworkProtocol.CreateResponseMessage(isValid, passing, uid, receivedMessageLength, dt); // assert string[] sa = result.Split('\r', '\n').Where(w => !string.IsNullOrEmpty(w)).Select(s => s).ToArray(); Assert.AreEqual(sa[0], "RESPONSE: VALID"); Assert.AreEqual(sa[1], "RECEIVED PASSING: 1"); Assert.AreEqual(sa[2], $"RECEIVED DATETIME: {this.GetDateTimeFormat(dt)}"); Assert.AreEqual(sa[3], "RECEIVED UID: 123"); Assert.AreEqual(sa[4], "RECEIVED LENGTH: 4"); }