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); }
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); }
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); }