Example #1
0
        public OutputFileHelper(string outputDirectory, ISystem system)
        {
            if (system == null)
            {
                throw new ArgumentNullException(nameof(system));
            }

            _dateTime = system.DateTime;
            if (_dateTime == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ErrorMessages.VariableNull, nameof(_dateTime)));
            }

            var environment = system.Environment;

            if (environment == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ErrorMessages.VariableNull, nameof(environment)));
            }

            _directory = system.IO?.Directory;
            if (_directory == null)
            {
                throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ErrorMessages.VariableNull, nameof(_directory)));
            }

            if (string.IsNullOrWhiteSpace(outputDirectory))
            {
                _outputDirectory = Path.Combine(environment.CurrentDirectory, DefaultOutputDirectoryName);
                return;
            }

            VerifyPathOrThrow(outputDirectory);
            _outputDirectory = outputDirectory;
        }
Example #2
0
        internal SystemIO(ISystemIODirectory directory, ISystemIOFile file, ISystemIOPath path)
        {
            Debug.Assert(directory != null, nameof(directory));
            Debug.Assert(file != null, nameof(file));
            Debug.Assert(path != null, nameof(path));

            Directory = directory;
            File      = file;
            Path      = path;
        }