Ejemplo n.º 1
0
        public void Initialize()
        {
            encryptedText = MockRepository.GenerateMock<IObservableText>();
            decrypter = MockRepository.GenerateMock<IDecrypter>();

            target = new DecryptedText(encryptedText);
            target.CurrentDecrypter = decrypter;
        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            IObservableText encryptedText = new ObservableText();
            IDecryptedText decryptedText = new DecryptedText(encryptedText);
            ITextHelper textChecker = new TextHelper();
            IXORKeyFinderFactory xorKeyFinderFactory = new XORKeyFinderFactory();
            ICaesarShiftDecrypter caesarShiftAlgorithm = new CaesarShiftDecrypter();
            IDecryptionSetupViewModel caesarShiftViemModel = new CaesarShiftSetupViewModel(caesarShiftAlgorithm, encryptedText);
            IXORDecrypter xorAlgorithm = new XORDecrypter(encryptedText, textChecker, xorKeyFinderFactory);
            IDecryptionSetupViewModel xorViewModel = new XORSetupViewModel(xorAlgorithm, encryptedText);
            IDecrypter monoAlphaAlgorithm = new MonoAlphaDecrypter();
            IDecryptionSetupViewModel monoAlphaViewModel = new MonoAlphaSetupViewModel(monoAlphaAlgorithm, encryptedText);

            DataContext = new DecrypterViewModel(
                encryptedText,
                decryptedText,
                Tuple.Create<IDecrypter, IDecryptionSetupViewModel>(caesarShiftAlgorithm, caesarShiftViemModel),
                Tuple.Create<IDecrypter, IDecryptionSetupViewModel>(xorAlgorithm, xorViewModel),
                Tuple.Create<IDecrypter, IDecryptionSetupViewModel>(monoAlphaAlgorithm, monoAlphaViewModel));
        }