예제 #1
0
 public void Constructor1_ValidParams_Sucess(string modularCryptFormatStr,
                                             char   expectedDelim,
                                             string expectedIdentifier,
                                             int    expectedWorkFactor,
                                             string expectedSaltAsBase64,
                                             string expectedCipherAsBase64)
 {
     var mc = new ModularCrypt(modularCryptFormatStr);
     Assert.AreEqual(expectedDelim,                                    mc.Delim);
     Assert.AreEqual(expectedIdentifier,                               mc.Identifier);
     Assert.AreEqual(expectedWorkFactor,                               mc.WorkFactor);
     Assert.AreEqual(Convert.FromBase64String(expectedSaltAsBase64),   mc.Salt);
     Assert.AreEqual(Convert.FromBase64String(expectedCipherAsBase64), mc.Cipher);
     Assert.AreEqual(modularCryptFormatStr,                            mc.ToString());
 }
예제 #2
0
        public void Constructor2_ValidParams_Sucess(char   delim,
                                                    string identifier,
                                                    int    workFactor,
                                                    string saltAsBase64,
                                                    string cipherAsBase64,
                                                    string expectedToString)
        {
            byte[] salt   = saltAsBase64   == null ? null : Convert.FromBase64String(saltAsBase64);
            byte[] cipher = cipherAsBase64 == null ? null : Convert.FromBase64String(cipherAsBase64);

            var mc = new ModularCrypt(delim,
                                      identifier,
                                      workFactor,
                                      salt,
                                      cipher);

            Assert.AreEqual(delim,            mc.Delim);
            Assert.AreEqual(identifier,       mc.Identifier);
            Assert.AreEqual(workFactor,       mc.WorkFactor);
            Assert.AreEqual(salt,             mc.Salt);
            Assert.AreEqual(cipher,           mc.Cipher);
            Assert.AreEqual(expectedToString, mc.ToString());
        }