Beispiel #1
0
        private void DoClient(TcpClient client)
        {
            Console.WriteLine("Waiting for Client");
            while (client.Connected)
            {
                var ns = client.GetStream();
                var sr = new StreamReader(ns);
                var sw = new StreamWriter(ns);
                sw.AutoFlush = true;
                string[] incStrings;

                incStrings = sr.ReadLine().Split(' ');

                Convert1Dll Convert = new Convert1Dll();

                string ConvertOptions = incStrings[0];
                if (ConvertOptions == "OzToGram")
                {
                    double grams  = double.Parse(incStrings[1]);
                    double result = Convert.OzToGrams(grams);
                    System.Console.WriteLine(result);
                    sw.WriteLine(result);
                }

                else if (ConvertOptions == "GramsToOz")
                {
                    double oz     = double.Parse(incStrings[1]);
                    double result = Convert.GramsToOz(oz);
                    sw.WriteLine(result);
                }

                sw.Flush();
            }
        }
Beispiel #2
0
        public void TestMethod2()
        {
            Convert1Dll c   = new Convert1Dll();
            double      var = 10;

            double actual = c.GramsToOz(var);

            double expected = var * Grams;

            Assert.AreEqual(actual, expected, 0.00000001);
        }
Beispiel #3
0
        public void TestMethod1()
        {
            Convert1Dll c   = new Convert1Dll();
            double      var = 10;

            double actual = c.OzToGrams(var);

            double expected = var * Oz;

            Assert.AreEqual(actual, expected, 0.00000001);
        }