public async void ReturnsNullWhenWhenTmconnReturnsFalse([Frozen] ITmNative native, TmsApi tms) { uint error; var errorBuf = new byte[80]; uint bufLength = 80; var buf = new char[bufLength]; A.CallTo(() => native.TmcGetCfsHandle(A <int> ._)) .Returns(new IntPtr(1)); A.CallTo(() => native.CfsDirEnum(new IntPtr(1), "", ref buf, bufLength, out error, ref errorBuf, 0)) .WithAnyArguments() .Returns(false); var result = await tms.GetFilesInDirectory(A.Dummy <string>()); result.Should().BeNull(); }
public async void ReturnsCorrectList([Frozen] ITmNative native, TmsApi tms) { uint error; var errorBuf = new byte[80]; uint bufLength = 80; var buf = new char[bufLength]; A.CallTo(() => native.TmcGetCfsHandle(A <int> ._)) .Returns(new IntPtr(1)); A.CallTo(() => native.CfsDirEnum(new IntPtr(1), "", ref buf, bufLength, out error, ref errorBuf, 0)) .WithAnyArguments() .Returns(true) .AssignsOutAndRefParameters(new[] { 'I', 't', 'e', 'm', '1', '\0', 'I', 't', 'e', 'm', '2', '\0', '\0', 'T', 'r', 'a', 's', 'h' }, A.Dummy <uint>(), A.Dummy <byte[]>()); var result = await tms.GetFilesInDirectory(A.Dummy <string>()); result.Should().Equal("Item1", "Item2"); }