コード例 #1
0
        private SaveFileWizard Setup(ISaveFileDialog saveFileDialog = null)
        {
            var saveFileDialogCreator = new StubISaveFileDialogCreator
            {
                CreateIFile = file => saveFileDialog
            };

            var fileFactory = new StubIFileFactory();

            return new SaveFileWizard(saveFileDialogCreator, fileFactory);
        }
コード例 #2
0
        public void WhenFileIsNotSelectedItWillReturnDefaultTypeValue()
        {
            var saveFileDialog = new StubISaveFileDialog
            {
                FileNameGet = () => null
            };
            var file = new MockFile();

            var fileCreator = new StubIFileFactory<MockFile>
            {
                CreateString = s => file
            };

            var fileResult = Setup(saveFileDialog).Save(fileCreator);

            Assert.AreEqual(default(MockFile), fileResult);
        }
コード例 #3
0
        public void WhenFileIsSelectedItWillCreateIt()
        {
            const string fileName = "fileName";
            var saveFileDialog = new StubISaveFileDialog
            {
                FileNameGet = () => fileName
            };
            var file = new MockFile();

            var fileCreator = new StubIFileFactory<MockFile>
            {
                CreateString = s => file
            };

            var fileResult = Setup(saveFileDialog).Save(fileCreator);

            Assert.AreEqual(file, fileResult);
        }