Esempio n. 1
0
        public void Ctor_ShouldNotThrow_WhenArgsIsNull()
        {
            // arrange
            IEnumerable <string> nullArgs = null;

            // act
            using var sut = new MedallionShellAdapter(
                      executable,
                      nullArgs,
                      stream,
                      null);

            // assert
            sut.Should().NotBeNull();
        }
Esempio n. 2
0
        public void Ctor_ShouldThrow_WhenOutputStreamArgumentIsNull()
        {
            // arrange
            Stream invalidStream = null;

            // act
            Action act = () => _ = new MedallionShellAdapter(
                executable,
                defaultArgs,
                invalidStream,
                null);

            // assert
            act.Should().ThrowExactly <ArgumentNullException>();
        }
Esempio n. 3
0
        public void Ctor_ShouldThrow_WhenExecutableArgumentIsWhitespaceString()
        {
            // arrange
            string invalidExecutable = "  ";

            // act
            Action act = () => _ = new MedallionShellAdapter(
                invalidExecutable,
                defaultArgs,
                stream,
                null);

            // assert
            act.Should().ThrowExactly <ArgumentException>();
        }
Esempio n. 4
0
        public void Ctor_ShouldNotThrow_WhenErrorStreamIsUsed()
        {
            // arrange
            using var errorStream = new MemoryStream();

            // act
            using var sut = new MedallionShellAdapter(
                      executable,
                      new List <string>
            {
                "bla",
                "RUBbi$h",
            },
                      stream,
                      errorStream);

            // assert
            sut.Should().NotBeNull();
        }
Esempio n. 5
0
        public MedallionShellAdapterTest(ITestOutputHelper output)
        {
            this.output  = output;
            mreSutExited = new ManualResetEventSlim(false);
            var defaultArgs = new List <string>
            {
                ExifToolArguments.StayOpen,
                ExifToolArguments.BoolTrue,
                "-@",
                "-",
            };

            stream = new WriteDelegatedDummyStream(new ExifToolStdOutWriter(Encoding.UTF8));
            var errorStream = new WriteDelegatedDummyStream(new ExifToolStdErrWriter(Encoding.UTF8));

            sut = new MedallionShellAdapter(ExifToolSystemConfiguration.ExifToolExecutable, defaultArgs, stream, errorStream);
            sut.ProcessExited += SutOnProcessExited;
            sut.Initialize();
        }