private void DoClient(TcpClient socket) { while (socket.Connected) { var Stream = socket.GetStream(); var sr = new StreamReader(Stream); var sw = new StreamWriter(Stream); sw.AutoFlush = true; string[] Strings; Strings = sr.ReadLine().Split(' '); string serverText = Strings[0].ToUpper(); if (serverText == "TOGRAMS") { double weight = double.Parse(Strings[1]); double result = Converts.ConvertToGrams(weight); sw.WriteLine(result); } else if (serverText == "TOOUNCES") { double weight = double.Parse(Strings[1]); double result = Converts.ConvertToOunces(weight); sw.WriteLine(result); } } }
public void TestMethod3() { Assert.AreEqual(1.03527396195, Converts.ConvertToOunces(1), 0.01); //Should test negatively }
public void TestMethod2() { Assert.AreEqual(0.03527396195, Converts.ConvertToOunces(1), 0.01); //Should test positively }