public void IsCompatibleTest() { // executing version 3.0.0.0, accepting connections from 2.0.0.0 var av = new ApiVersion(new Version(3, 0, 0, 0), new Version(2, 0, 0, 0)); // server version 1.0.0.0 is not compatible (too old) Assert.IsFalse(av.IsCompatibleWith(new Version(1, 0, 0, 0))); // server version 2.0.0.0 or 3.0.0.0 is compatible Assert.IsTrue(av.IsCompatibleWith(new Version(2, 0, 0, 0))); Assert.IsTrue(av.IsCompatibleWith(new Version(3, 0, 0, 0))); // server version 4.0.0.0 is not compatible (too recent) Assert.IsFalse(av.IsCompatibleWith(new Version(4, 0, 0, 0))); // but can declare it is, indeed, compatible with version 2.0.0.0 or 3.0.0.0 Assert.IsTrue(av.IsCompatibleWith(new Version(4, 0, 0, 0), new Version(2, 0, 0, 0))); Assert.IsTrue(av.IsCompatibleWith(new Version(4, 0, 0, 0), new Version(3, 0, 0, 0))); // but... Assert.IsFalse(av.IsCompatibleWith(new Version(4, 0, 0, 0), new Version(3, 0, 0, 1))); }