// Copyright 2017-2018 Alexander Luzgarev using Xunit; namespace MatFileHandler.Tests { /// /// Tests of the ComplexOf value type. /// public class ComplexOfTests { /// /// Test getting real and imaginary parts. /// [Fact] public void TestAccessors() { var c = new ComplexOf(1, 2); Assert.Equal(1, c.Real); Assert.Equal(2, c.Imaginary); } /// /// Test equality operators. /// [Fact] public void TestEquals() { var c1 = new ComplexOf(1, 2); var c2 = new ComplexOf(3, 4); var c3 = new ComplexOf(1, 2); Assert.True(c1 == c3); Assert.True(c1 != c2); Assert.True(c2 != c3); } /// /// Test hash code calculation. /// [Fact] public void TestGetHashCode() { var c1 = new ComplexOf(1, 2); var c2 = new ComplexOf(1, 2); var h1 = c1.GetHashCode(); var h2 = c2.GetHashCode(); Assert.Equal(h1, h2); } } }