コード例 #1
0
ファイル: FileOpeningTests.cs プロジェクト: ag-csharp/Camelot
        public void TestFileServiceOpeningWindows()
        {
            var processServiceMock = new Mock <IProcessService>();

            processServiceMock
            .Setup(m => m.Run(FileName))
            .Verifiable();

            var fileOpeningService = new WindowsResourceOpeningService(processServiceMock.Object);

            fileOpeningService.Open(FileName);

            processServiceMock.Verify(m => m.Run(FileName), Times.Once());
        }
コード例 #2
0
        public void TestFileServiceOpeningWindows()
        {
            const string fileName           = "File.txt";
            const string command            = "explorer";
            var          arguments          = $"\"{fileName}\"";
            var          processServiceMock = new Mock <IProcessService>();

            processServiceMock
            .Setup(m => m.Run(command, arguments))
            .Verifiable();

            var fileOpeningService = new WindowsResourceOpeningService(processServiceMock.Object);

            fileOpeningService.Open(fileName);

            processServiceMock.Verify(m => m.Run(command, arguments), Times.Once());
        }