Пример #1
0
        public void ShouldUpdateReturnsTrueIfOldHashAndPackageHashAreDifferent()
        {
            // Arrange
            var servicePackage = new DataServicePackage {
                Id = "A",
                Version = "1.2",
                PackageHash = "NEWHASH"
            };

            // Act
            bool shouldUpdate = servicePackage.ShouldUpdatePackage(new MockPackageRepository());

            // Assert
            Assert.IsTrue(shouldUpdate);
        }
Пример #2
0
        public void ShouldUpdateReturnsTrueIfOldHashAndPackageHashAreDifferent()
        {
            // Arrange
            var servicePackage = new DataServicePackage {
                Id          = "A",
                Version     = "1.2",
                PackageHash = "NEWHASH"
            };

            // Act
            bool shouldUpdate = servicePackage.ShouldUpdatePackage(new MockPackageRepository());

            // Assert
            Assert.IsTrue(shouldUpdate);
        }
Пример #3
0
        public void ShouldUpdateReturnsTrueIfRepositoryPackageHashIsDifferentFromPackageHash()
        {
            // Arrange
            var servicePackage = new DataServicePackage {
                Id          = "A",
                Version     = "1.2",
                PackageHash = "HASH",
                OldHash     = "HASH"
            };

            var repository = new MockPackageRepository {
                PackageUtility.CreatePackage("A", "1.2")
            };

            // Act
            bool shouldUpdate = servicePackage.ShouldUpdatePackage(repository);

            // Assert
            Assert.IsTrue(shouldUpdate);
        }
Пример #4
0
        public void ShouldUpdateReturnsTrueIfRepositoryPackageHashIsDifferentFromPackageHash()
        {
            // Arrange
            var servicePackage = new DataServicePackage {
                Id = "A",
                Version = "1.2",
                PackageHash = "HASH",
                OldHash = "HASH"
            };

            var repository = new MockPackageRepository {
                PackageUtility.CreatePackage("A", "1.2")
            };

            // Act
            bool shouldUpdate = servicePackage.ShouldUpdatePackage(repository);

            // Assert
            Assert.IsTrue(shouldUpdate);
        }
        public void ShouldUpdateReturnsTrueIfPackageNotInRepository()
        {
            // Arrange
            var servicePackage = new DataServicePackage
            {
                Id = "A",
                Version = "1.2",
                PackageHash = "HASH",
                OldHash = "HASH"
            };

            // Act
            bool shouldUpdate = servicePackage.ShouldUpdatePackage(new MockPackageRepository());

            // Assert
            Assert.True(shouldUpdate);
        }
        public void ShouldUpdateReturnsTrueIfRepositoryThrows()
        {
            // Arrange
            var servicePackage = new DataServicePackage
            {
                Id = "A",
                Version = "1.2",
                PackageHash = "HASH",
                OldHash = "HASH"
            };

            var repository = new Mock<MockPackageRepository>();
            repository.Setup(m => m.GetPackages()).Throws(new Exception());

            // Act
            bool shouldUpdate = servicePackage.ShouldUpdatePackage(repository.Object);

            // Assert
            Assert.True(shouldUpdate);
        }