public void TestProcessNfieldOrPs_ArrayObject_CallsCorrectActions() { ArrayList input = new ArrayList(); PSObject arrayInput = new PSObject(input); PSObject psInput = new PSObject(); input.Add(psInput); input.Add(psInput); int count = 0; var mockedMapper = new Mock<IPSObjectMapper>(); mockedMapper.Setup(x => x.To<Interviewer>(psInput)) .Returns(new Interviewer()); ProcessHelper target = new ProcessHelper(mockedMapper.Object); target.ProcessNfieldOrPs<Interviewer>(arrayInput, (item) => { ++count; }); Assert.Equal(2, count); }
public void TestProcessNfieldOrPs_ObjectCanBeMapped_CallsNfieldAction() { int count = 0; var mockedMapper = new Mock<IPSObjectMapper>(); var input = new PSObject(); mockedMapper.Setup(x => x.To<Interviewer>(input)) .Returns(new Interviewer()); ProcessHelper target = new ProcessHelper(mockedMapper.Object); target.ProcessNfieldOrPs<Interviewer>(input, (item) => { ++count; }); Assert.Equal(1, count); }
public void TestProcessNfieldOrPs_ObjectCannotBeMapped_NotCallsNfieldAction() { int count = 0; var mockedMapper = new Mock<IPSObjectMapper>(); var input = new PSObject(); ProcessHelper target = new ProcessHelper(mockedMapper.Object); target.ProcessNfieldOrPs<Interviewer>(input, (item) => { ++count; }); Assert.Equal(0, count); }