public void OnFileUploadStarting()
        {
            // arrange
            var vm = new PaperclipsViewModel();

            var e = Mock.Create<FileUploadStartingEventArgs>(Behavior.CallOriginal);

            var uploadData = new RadUploadPostData
                {
                    FileName = "1#.txt"
                };

            Mock.Arrange(() => e.UploadData).Returns(uploadData);

            // act
            vm.OnFileUploadStarting(null, e);

            // assert
            Assert.AreEqual("1_.txt", e.UploadData.FileName);
        }
        public void OnFileUploadStarting()
        {
            // arrange
            var vm = new FieldFileViewModel();

            var e = Mock.Create<FileUploadStartingEventArgs>();

            var uploadData = new RadUploadPostData
                {
                    FileName = "1.txt"
                };

            Mock.Arrange(() => e.UploadData).Returns(uploadData);

            var fileProcess = Mock.Create<IFileProcess>(Behavior.Loose);
            Mock.NonPublic.Arrange<IFileProcess>(vm, "CurrentFileProcess").Returns(fileProcess);

            var parentModel = Mock.Create<IEditableRoot>(Behavior.Loose);
            Mock.NonPublic.Arrange<IEditableRoot>(vm, "ParentModel").Returns(parentModel);

            short count = 0;
            Mock.NonPublic.Arrange(vm, "RaisePropertyChanged", "IsFocused").DoInstead(() => { count++; });

            // act
            vm.OnFileUploadStarting(null, e);

            // assert
            Assert.AreEqual("1.txt", fileProcess.OriginalFileName);
            Assert.AreNotEqual("1.txt", uploadData.FileName);
            Assert.IsNotNull(fileProcess.FileName);

            Assert.AreEqual(2, count);

            // arrange
            fileProcess.OriginalFileName = null;

            // act
            vm.OnFileUploadStarting(null, null);

            // assert
            Assert.IsNull(fileProcess.OriginalFileName);
        }