Ejemplo n.º 1
0
        public void ProcessData_WhenSenderIsNotPSDataCollection_Throws()
        {
            var sender = new PSDataCollection <object>();

            Assert.Throws <ArgumentException>(
                () =>
                PwshRunner.ProcessData <PSObject>(sender, 0, _ => { })
                );
        }
Ejemplo n.º 2
0
        public void ProcessData_WhenSenderIsPSDataCollection_InvokesAction()
        {
            var sender = new PSDataCollection <object>();
            var str    = "";
            var mock   = new Mock <Action <object> >();

            sender.Add(str);

            PwshRunner.ProcessData <object>(sender, 0, mock.Object);

            mock.Verify(m => m.Invoke(str));
        }
Ejemplo n.º 3
0
        public void ProcessData_WhenSenderIsPSDataCollection_RemovesItemFromCollection()
        {
            var sender   = new PSDataCollection <string>();
            var expected = "string0";

            sender.Add(expected);
            sender.Add("string1");

            PwshRunner.ProcessData <string>(sender, 0, o => { });

            Assert.Single(sender);
            Assert.DoesNotContain(sender, o => expected.Equals(o));
        }