public void RemoteAssemblyReturns0IfAllValuesAreIdentical() { // Arrange var assemblyA = new RemoteAssembly("A", new Version("1.0.0.0"), "public-key", "en-us"); var assemblyB = new RemoteAssembly("A", new Version("1.0.0.0"), "public-key", "en-us"); // Act var result = RemoteAssembly.Compare(assemblyA, assemblyB); // Assert Assert.Equal(0, result); }
public void RemoteAssemblyComparesById() { // Arrange var assemblyA = new RemoteAssembly("A", null, null, null); var assemblyB = new Mock <IAssembly>(MockBehavior.Strict); assemblyB.SetupGet(b => b.Name).Returns("Z").Verifiable(); // Act var result = RemoteAssembly.Compare(assemblyA, assemblyB.Object); // Assert Assert.Equal(-25, result); assemblyB.Verify(); }
public void RemoteAssemblyComparesByVersionIfIdsAreIdentical() { // Arrange var assemblyA = new RemoteAssembly("A", new Version("2.0.0.0"), null, null); var assemblyB = new Mock <IAssembly>(MockBehavior.Strict); assemblyB.SetupGet(b => b.Name).Returns("A").Verifiable(); assemblyB.SetupGet(b => b.Version).Returns(new Version("1.0.0.0")).Verifiable(); // Act var result = RemoteAssembly.Compare(assemblyA, assemblyB.Object); // Assert Assert.Equal(1, result); assemblyB.Verify(); }
public void RemoteAssemblyComparesByCultureIfIdVersionAndPublicKeyAreIdentical() { // Arrange var assemblyA = new RemoteAssembly("A", new Version("1.0.0.0"), "public-key", "en-us"); var assemblyB = new Mock <IAssembly>(MockBehavior.Strict); assemblyB.SetupGet(b => b.Name).Returns("A").Verifiable(); assemblyB.SetupGet(b => b.Version).Returns(new Version("1.0.0.0")).Verifiable(); assemblyB.SetupGet(b => b.PublicKeyToken).Returns("public-key").Verifiable(); assemblyB.SetupGet(b => b.Culture).Returns("en-uk").Verifiable(); // Act var result = RemoteAssembly.Compare(assemblyA, assemblyB.Object); // Assert Assert.Equal(8, result); assemblyB.Verify(); }