コード例 #1
0
        public void CanDeTokeniseABasicStringInConsistentMode()
        {
            var tokenTable = GenerateTable(Size, Alphabet.English);
            var service    = new BasicService(new ServiceSettings {
                Behaviour = Behaviour.Consistent
            });
            var resultString = service.Tokenize(TestString1, tokenTable).Value;

            resultString = service.Detokenize(new BasicRequest(resultString), tokenTable).Value;
            Assert.AreEqual(TestString1, resultString);
        }
コード例 #2
0
        public void CanDeTokeniseABasicStringInLengthBasedInconsistentModeAndActionTypeIsCorrect()
        {
            var tokenTable = GenerateTable(Size, Alphabet.English);
            var service    = new BasicService(new ServiceSettings());
            var result     = service.Tokenize(TestString1, tokenTable);

            Assert.AreEqual(ActionType.Tokenize, result.Action);
            var resultString = result.Value;

            result       = service.Detokenize(new BasicRequest(resultString), tokenTable);
            resultString = result.Value;
            Assert.AreEqual(ActionType.Detokenize, result.Action);
            Assert.AreEqual(TestString1, resultString);
        }
コード例 #3
0
        public void CanDeTokeniseABasicStringInRandomSeedInconsistentModeAndEncrypted()
        {
            var tokenTable = GenerateTable(Size, Alphabet.English);
            var service    = new BasicService(new ServiceSettings()
            {
                Behaviour = Behaviour.RandomSeedInconsistent, Encrypt = true, Key = Key, IV = IV
            }, new Encryption(), new Compression());
            var result = service.Tokenize(TestString1, tokenTable);

            Assert.AreEqual(ActionType.Tokenize, result.Action);
            var resultString = result.Value;

            result       = service.Detokenize(new BasicRequest(resultString), tokenTable);
            resultString = result.Value;
            Assert.AreEqual(ActionType.Detokenize, result.Action);
            Assert.AreEqual(TestString1, resultString);
        }