示例#1
0
            public void ReturnTheRightHash_WhenTheFileIsRegistered()
            {
                // Arrange
                string _hash;

                // Act
                _hash = _clientDb.GetHash(1, 5);

                // Assert
                Assert.AreEqual("55555555555555555555555555555555", _hash);
            }
示例#2
0
            public void WriteTheNewHash_WhenFileIdAndChunkIdMatchARecord()
            {
                // Arrange
                string expectedHash = "01234567890123456789012345678901";
                string actualHash   = String.Empty;

                // Act
                actualHash = _clientDb.GetHash(1, 0);
                Assert.AreEqual("00000000000000000000000000000000", actualHash);
                _clientDb.UpdateHash(1, 0, expectedHash);
                actualHash = _clientDb.GetHash(1, 0);

                // Assert
                Assert.AreEqual(expectedHash, actualHash);
            }
示例#3
0
            public void InsertTheHash_WhenCalled()
            {
                // Arrange
                string expectedHash = "109487142ACBEDFABDEC123412348907";
                string actualHash   = String.Empty;

                // Act
                _clientDb.InsertHash(1, 6, expectedHash);
                actualHash = _clientDb.GetHash(1, 6);

                // Assert
                Assert.AreEqual(expectedHash, actualHash, true);
            }
示例#4
0
            public void DeleteTheHash_WhenCalled()
            {
                // Arrange
                List <string> hashes;
                string        hash         = String.Empty;
                string        expectedHash = "109487142ACBEDFABDEC123412348907";

                // Act
                for (int i = 0; i < 10; i++)
                {
                    _clientDb.InsertHash(1, i, expectedHash);
                }
                hashes = _clientDb.GetHashes(1);
                Assert.AreEqual(10, hashes.Count);
                hash = hashes[0];
                Assert.AreEqual(expectedHash, hash);
                _clientDb.DeleteHash(1, 0);
                hashes = _clientDb.GetHashes(1);
                hash   = _clientDb.GetHash(1, 0);

                // Assert
                Assert.AreEqual(9, hashes.Count);
                Assert.AreEqual(string.Empty, hash);
            }