|
| 1 | +namespace Dijkstra.NET.Tests |
| 2 | +{ |
| 3 | + using Microsoft.VisualStudio.TestTools.UnitTesting; |
| 4 | + using Model; |
| 5 | + |
| 6 | + [TestClass] |
| 7 | + public class EdgeTest |
| 8 | + { |
| 9 | + [TestMethod] |
| 10 | + public void Two_Edges_Should_Be_Equal() |
| 11 | + { |
| 12 | + var a = new Edge<string, int>(new Node<string, int>(0, "node1"), 1, 1); |
| 13 | + var b = new Edge<string, int>(new Node<string, int>(0, "node2"),1, 1); |
| 14 | + |
| 15 | + bool act = a.Equals(b); |
| 16 | + |
| 17 | + Assert.IsTrue(act); |
| 18 | + } |
| 19 | + |
| 20 | + [TestMethod] |
| 21 | + public void Two_Edges_Should_Be_Equal_With_Null_References() |
| 22 | + { |
| 23 | + var a = new Edge<string, string>(new Node<string, string>(0, "node1"), 1, null); |
| 24 | + var b = new Edge<string, string>(new Node<string, string>(0, "node2"),1, null); |
| 25 | + |
| 26 | + bool act = a.Equals(b); |
| 27 | + |
| 28 | + Assert.IsTrue(act); |
| 29 | + } |
| 30 | + |
| 31 | + [TestMethod] |
| 32 | + public void Two_Edges_Should_Be_Diffrent_With_Null_Reference() |
| 33 | + { |
| 34 | + var a = new Edge<string, string>(new Node<string, string>(0, "node1"), 1, null); |
| 35 | + var b = new Edge<string, string>(new Node<string, string>(0, "node2"),1, "a"); |
| 36 | + |
| 37 | + bool act = a.Equals(b); |
| 38 | + bool act2 = b.Equals(a); |
| 39 | + |
| 40 | + Assert.IsFalse(act); |
| 41 | + Assert.IsFalse(act2); |
| 42 | + } |
| 43 | + |
| 44 | + [TestMethod] |
| 45 | + public void Two_Edges_Should_Be_Diffrent_With_Diffrent_Parameter() |
| 46 | + { |
| 47 | + var a = new Edge<string, string>(new Node<string, string>(0, "node1"), 1, "b"); |
| 48 | + var b = new Edge<string, string>(new Node<string, string>(0, "node2"),1, "a"); |
| 49 | + |
| 50 | + bool act = a.Equals(b); |
| 51 | + bool act2 = b.Equals(a); |
| 52 | + |
| 53 | + Assert.IsFalse(act); |
| 54 | + Assert.IsFalse(act2); |
| 55 | + } |
| 56 | + |
| 57 | + [TestMethod] |
| 58 | + public void Two_Edges_Should_Be_Diffrent_With_Diffrent_Costs() |
| 59 | + { |
| 60 | + var a = new Edge<string, string>(new Node<string, string>(0, "node1"), 3, "a"); |
| 61 | + var b = new Edge<string, string>(new Node<string, string>(0, "node2"),1, "a"); |
| 62 | + |
| 63 | + bool act = a.Equals(b); |
| 64 | + bool act2 = b.Equals(a); |
| 65 | + |
| 66 | + Assert.IsFalse(act); |
| 67 | + Assert.IsFalse(act2); |
| 68 | + } |
| 69 | + |
| 70 | + [TestMethod] |
| 71 | + public void Two_Edges_Should_Be_Diffrent_With_Diffrent_Nodes() |
| 72 | + { |
| 73 | + var a = new Edge<string, string>(new Node<string, string>(0, "node1"), 1, "a"); |
| 74 | + var b = new Edge<string, string>(new Node<string, string>(1, "node2"),1, "a"); |
| 75 | + |
| 76 | + bool act = a.Equals(b); |
| 77 | + bool act2 = b.Equals(a); |
| 78 | + |
| 79 | + Assert.IsFalse(act); |
| 80 | + Assert.IsFalse(act2); |
| 81 | + } |
| 82 | + } |
| 83 | +} |
0 commit comments