public void Initialize()
        {
            decrypter = MockRepository.GenerateMock<ICaesarShiftDecrypter>();
            observableText = MockRepository.GenerateMock<IObservableText>();

            target = new CaesarShiftSetupViewModel(decrypter, observableText);
        }
 public MonoAlphaSetupViewModel(IDecrypter decrypter, IObservableText encryptedText)
 {
     this.decrypter = decrypter;
     this.encryptedText = encryptedText;
     LoadSampleTextCommand = new SimpleDelegateCommand(LoadSampleText);
     encryptedText.TextChanged += OnEncryptedTextChanged;
 }
Exemplo n.º 3
0
        public XORKeyFinder(IObservableText encryptedText, ITextHelper textChecker, byte lowerKeyBound, byte upperKeyBound, params string[] wordsToFind) {
            this.encryptedText = encryptedText;
            this.textChecker = textChecker;
            this.lowerKeyBound = lowerKeyBound;
            this.upperKeyBound = upperKeyBound;
            this.wordsToFind = wordsToFind;
	    }
        public void Initialize()
        {
            encryptedText = MockRepository.GenerateMock<IObservableText>();
            decryptedText = MockRepository.GenerateMock<IDecryptedText>();
            SetupDecrypterAndViewModelTuples(4);

            target = new DecrypterViewModel(encryptedText, decryptedText, decryptersAndViewModels);
        }
Exemplo n.º 5
0
 public DecrypterViewModel(IObservableText encryptedText, IDecryptedText decryptedText, params Tuple<IDecrypter, IDecryptionSetupViewModel>[] decryptionAlgorithmsVMPairs)
 {
     this.encryptedText = encryptedText;
     this.decryptedText = decryptedText;
     encryptedText.TextChanged += (s, e) => OnPropertyChanged("EncryptedText");
     decryptedText.TextChanged += (s, e) => OnPropertyChanged("DecryptedText");
     InitialiseDecryptersAndViewModels(decryptionAlgorithmsVMPairs);
 }
        public void Initialize()
        {
            encryptedText = MockRepository.GenerateMock<IObservableText>();
            decrypter = MockRepository.GenerateMock<IDecrypter>();

            target = new DecryptedText(encryptedText);
            target.CurrentDecrypter = decrypter;
        }
 public CaesarShiftSetupViewModel(ICaesarShiftDecrypter decrypter, IObservableText encryptedText)
 {
     this.decrypter = decrypter;
     this.encryptedText = encryptedText;
     ShiftUpCommand = new SimpleDelegateCommand(() => Shift++);
     ShiftDownCommand = new SimpleDelegateCommand(() => Shift--);
     LoadSampleTextCommand = new SimpleDelegateCommand(LoadSampleText);
 }
Exemplo n.º 8
0
        public void Initialize() {
            encryptedText = MockRepository.GenerateMock<IObservableText>();
            textChecker = MockRepository.GenerateMock<ITextHelper>();
            wordsToFind = new string[] { "one", "two", "three" };
            testKey = new byte[] { 10, 10, 10 };
            keysTried = new List<byte[]>();

            target = new XORKeyFinder(encryptedText, textChecker, lowerKeyBound, upperKeyBound, wordsToFind);
        }
Exemplo n.º 9
0
 public XORDecrypter(
     IObservableText encryptedText,
     ITextHelper textChecker,
     IXORKeyFinderFactory xorKeyFinderFactory,
     params byte[] key) {
     this.encryptedText = encryptedText;
     this.textHelper = textChecker;
     this.xorKeyFinderFactory = xorKeyFinderFactory;
     Key = key;
 }
Exemplo n.º 10
0
        public void Initialize()
        {
            encryptedText = MockRepository.GenerateMock<IObservableText>();
            textHelper = MockRepository.GenerateMock<ITextHelper>();
            xorKeyFinderFactory = MockRepository.GenerateMock<IXORKeyFinderFactory>();
            xorKeyFinder = MockRepository.GenerateMock<IXORKeyFinder>();
            xorKeyFinderFactory.Stub(x => x.Create(null, null, 0, 0)).IgnoreArguments().Return(xorKeyFinder);

            target = new XORDecrypter(encryptedText, textHelper, xorKeyFinderFactory);
        }
Exemplo n.º 11
0
 public XORSetupViewModel(IXORDecrypter decrypter, IObservableText encryptedText)
 {
     this.decrypter = decrypter;
     this.encryptedText = encryptedText;
     FindKeyCommand = new SimpleDelegateCommand(FindKey);
     LoadSampleTextCommand = new SimpleDelegateCommand(LoadSampleText);
     decrypter.KeyChanged += HandleKeyChanged;
     KeyAutoSearchLowerBound = 97;
     KeyAutoSearchUpperBound = 122;
     WordsToFind = string.Empty;
 }
Exemplo n.º 12
0
 public DecryptedText(IObservableText encryptedText)
 {
     this.encryptedText = encryptedText;
     encryptedText.TextChanged += HandleEncryptedTextChanged;
 }
Exemplo n.º 13
0
 public IXORKeyFinder Create(IObservableText encryptedText, ITextHelper textChecker, byte lowerKeyBound, byte upperKeyBound, params string[] wordsToFind)
 {
     return new XORKeyFinder(encryptedText, textChecker, lowerKeyBound, upperKeyBound, wordsToFind);
 }