Esempio n. 1
0
        public void On_FileDrop_format_and_two_files_button_has_title_as_files_bufer()
        {
            // Arrange
            var file1 = "c:\\file1.ext";
            var file2 = "c:\\file2.ext";
            var data  = new DataObject(DataFormats.FileDrop, new string[] { file1, file2 });
            var bufer = new Bufer
            {
                ViewModel = new BuferViewModel
                {
                    Clip = data
                }
            };

            // Act
            var wrapper = new BuferHandlersWrapper(
                A.Fake <IClipboardBuferService>(),
                A.Fake <IBuferContextMenuGenerator>(),
                A.Fake <IBuferSelectionHandlerFactory>(),
                A.Fake <IFileStorage>(),
                A.Fake <IBufermanHost>(),
                A.Fake <IProgramSettingsGetter>(),
                A.Fake <IProgramSettingsSetter>(),
                new List <IBufermanPlugin>(),
                bufer);

            // Assert
            Assert.AreEqual($"<< {Resource.FilesBufer} (2) >>", bufer.ViewModel.OriginBuferTitle);
        }
Esempio n. 2
0
        public void On_FileDrop_format_and_one_file_When_file_name_is_short_Origin_bufer_title_contains_filename()
        {
            // Arrange
            var file  = "c:\\file.txt";
            var data  = new DataObject(DataFormats.FileDrop, new string[] { file });
            var bufer = new Bufer
            {
                ViewModel = new BuferViewModel
                {
                    Clip = data
                }
            };
            var programSettingsGetter = A.Fake <IProgramSettingsGetter>();

            A.CallTo(() => programSettingsGetter.MaxFilePathLengthForBuferTitle)
            .Returns(300);

            // Act
            var wrapper = new BuferHandlersWrapper(
                A.Fake <IClipboardBuferService>(),
                A.Fake <IBuferContextMenuGenerator>(),
                A.Fake <IBuferSelectionHandlerFactory>(),
                A.Fake <IFileStorage>(),
                A.Fake <IBufermanHost>(),
                programSettingsGetter,
                A.Fake <IProgramSettingsSetter>(),
                new List <IBufermanPlugin>(),
                bufer);

            // Assert
            Assert.AreEqual($"<< {file} >>", bufer.ViewModel.OriginBuferTitle);
        }
Esempio n. 3
0
        public void Sets_OriginalBuferTitle_With_Whitespaces_Count_On_whitespaces_clip()
        {
            // Arrange
            var data  = new DataObject(DataFormats.UnicodeText, "   ");
            var bufer = new Bufer
            {
                ViewModel = new BuferViewModel
                {
                    Clip = data,
                    TextRepresentation = "   "
                }
            };
            var oldFont = bufer.Font;

            // Act
            var wrapper = new BuferHandlersWrapper(
                A.Fake <IClipboardBuferService>(),
                A.Fake <IBuferContextMenuGenerator>(),
                A.Fake <IBuferSelectionHandlerFactory>(),
                A.Fake <IFileStorage>(),
                A.Fake <IBufermanHost>(),
                A.Fake <IProgramSettingsGetter>(),
                A.Fake <IProgramSettingsSetter>(),
                new List <IBufermanPlugin>(),
                bufer);

            // Assert
            Assert.AreEqual($"<< 3   {Resource.WhiteSpaces} >>", bufer.ViewModel.OriginBuferTitle);
            Assert.AreEqual(new Font(oldFont, FontStyle.Italic | FontStyle.Bold), bufer.Font);
        }
Esempio n. 4
0
        public void Sets_Trimmed_TextRepresentation_To_OriginBuferTitle()
        {
            // Arrange
            var originText = " Text";
            var data       = new DataObject(DataFormats.Text, originText);

            data.SetData(DataFormats.StringFormat, string.Empty);
            var bufer = new Bufer()
            {
                ViewModel = new BuferViewModel()
                {
                    Clip = data,
                    TextRepresentation = originText
                }
            };

            // Act
            var wrapper = new BuferHandlersWrapper(
                A.Fake <IClipboardBuferService>(),
                A.Fake <IBuferContextMenuGenerator>(),
                A.Fake <IBuferSelectionHandlerFactory>(),
                A.Fake <IFileStorage>(),
                A.Fake <IBufermanHost>(),
                this._settingsGetter.FakedObject,
                A.Fake <IProgramSettingsSetter>(),
                new List <IBufermanPlugin>(),
                bufer);

            // Assert
            Assert.AreEqual("Text", bufer.ViewModel.OriginBuferTitle);
        }
Esempio n. 5
0
        public void On_null_button_has_text_with_whitespaces_count()
        {
            // Arrange
            var data  = new DataObject(DataFormats.UnicodeText, null);
            var bufer = new Bufer
            {
                ViewModel = new BuferViewModel
                {
                    Clip = data
                }
            };
            var oldFont = bufer.Font;

            // Act
            var wrapper = new BuferHandlersWrapper(
                A.Fake <IClipboardBuferService>(),
                A.Fake <IBuferContextMenuGenerator>(),
                A.Fake <IBuferSelectionHandlerFactory>(),
                A.Fake <IFileStorage>(),
                A.Fake <IBufermanHost>(),
                A.Fake <IProgramSettingsGetter>(),
                A.Fake <IProgramSettingsSetter>(),
                new List <IBufermanPlugin>(),
                bufer);

            // Assert
            Assert.AreEqual(Resource.NotTextBufer, bufer.ViewModel.OriginBuferTitle);
            Assert.AreEqual(new Font(oldFont, FontStyle.Italic | FontStyle.Bold), bufer.Font);
        }
Esempio n. 6
0
        public void On_FILE_CONTENTS_FORMAT_button_has_file_contents_in_text()
        {
            // Arrange
            var data  = new DataObject(ClipboardFormats.FILE_CONTENTS_FORMAT, new object());
            var bufer = new Bufer
            {
                ViewModel = new BuferViewModel
                {
                    Clip = data,
                    TextRepresentation = "File Content"
                }
            };
            var oldFont = bufer.Font;

            // Act
            var wrapper = new BuferHandlersWrapper(
                A.Fake <IClipboardBuferService>(),
                A.Fake <IBuferContextMenuGenerator>(),
                A.Fake <IBuferSelectionHandlerFactory>(),
                A.Fake <IFileStorage>(),
                A.Fake <IBufermanHost>(),
                A.Fake <IProgramSettingsGetter>(),
                A.Fake <IProgramSettingsSetter>(),
                new List <IBufermanPlugin>(),
                bufer);

            // Assert
            Assert.AreEqual("File Content", bufer.ViewModel.OriginBuferTitle);
            Assert.AreEqual(new Font(oldFont, FontStyle.Italic | FontStyle.Bold), bufer.Font);
        }