Example #1
0
        public void Verify_hash_code()
        {
            var dataPoint = new ComplexDataPoint(0.8, new Complex(0.2, 0.5));
            var hashCode  = dataPoint.GetHashCode();

            Assert.AreEqual(-1892473190, hashCode);
        }
Example #2
0
        public void Verify_hash_code_with_parameter()
        {
            var dataPoint1 = new ComplexDataPoint(0.8, new Complex(0.2, 0.5));
            var dataPoint2 = new ComplexDataPoint(0.8, new Complex(0.9, 0.5));
            var hashCode   = dataPoint1.GetHashCode(dataPoint2);

            Assert.AreEqual(-1882801729, hashCode);
        }
Example #3
0
        public void Verify_ComplexDataPoint_sets_correct_x_and_y_values()
        {
            var dataPoint = new ComplexDataPoint(0.1, new Complex(0.2, 0.3));

            Assert.AreEqual(0.1, dataPoint.X);
            Assert.AreEqual(0.2, dataPoint.Y.Real);
            Assert.AreEqual(0.3, dataPoint.Y.Imaginary);
        }
Example #4
0
        public void verify_constructor_sets_complex_properties_correctly()
        {
            IDataPoint[] dataPoints = new ComplexDataPoint[2]
            {
                new ComplexDataPoint(0.1, new Complex(0.2, 0.3)), new ComplexDataPoint(0.4, new Complex(0.5, 0.6))
            };
            var plotData = new PlotData(dataPoints, "title");

            Assert.AreEqual(plotData.Points[0], dataPoints[0]);
            Assert.AreEqual(plotData.Points[1], dataPoints[1]);
            Assert.AreEqual(plotData.Title, "title");
        }
Example #5
0
        public void Verify_ComplexDataPoint_equals_methods_work_correctly()
        {
            var dataPoint1 = new ComplexDataPoint(0.1, new Complex(0.2, 0.3));
            var dataPoint2 = new ComplexDataPoint(0.1, new Complex(0.2, 0.4));

            Assert.AreEqual(false, dataPoint1.Equals(dataPoint2));
            Assert.IsFalse(dataPoint1.Equals(dataPoint2));
            var dataPoint3 = new ComplexDataPoint(0.1, new Complex(0.2, 0.3));

            Assert.AreEqual(true, dataPoint1.Equals(dataPoint3));
            Assert.IsTrue(dataPoint1.Equals(dataPoint3));
            Assert.IsTrue(dataPoint1.Equals(dataPoint1, dataPoint3));
        }
Example #6
0
        public void Verify_to_string_value()
        {
            var dataPoint = new ComplexDataPoint(0.1, new Complex(0.3, 0.1));

            Assert.AreEqual("0.1, (0.3, 0.1)", dataPoint.ToString());
        }