public static TmServer CreateFromIfaceServer(TmNativeDefs.IfaceServer ifaceServer) { var name = EncodingUtil.Win1251BytesToUtf8(ifaceServer.Name); var comment = EncodingUtil.Win1251BytesToUtf8(ifaceServer.Comment); var tmServer = new TmServer((name, comment, ifaceServer.Signature, ifaceServer.Unique).ToTuple().GetHashCode()) { Name = name, Comment = comment, Signature = ifaceServer.Signature, Unique = ifaceServer.Unique, ProcessId = ifaceServer.Pid, ParentProcessId = ifaceServer.Ppid, Flags = ifaceServer.Flags, DbgCnt = ifaceServer.DbgCnt, LoudCnt = ifaceServer.LoudCnt, BytesIn = ifaceServer.BytesIn, BytesOut = ifaceServer.BytesOut, State = ifaceServer.State, CreationTime = DateUtil.GetDateTimeFromTimestamp(ifaceServer.CreationTime), ResState = ifaceServer.ResState }; return(tmServer); }
public void ReturnsFalseForWrongChildren(TmNativeDefs.IfaceServer ifaceServer) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var fixture = new Fixture(); fixture.Behaviors.OfType <ThrowingRecursionBehavior>().ToList() .ForEach(b => fixture.Behaviors.Remove(b)); fixture.Behaviors.Add(new OmitOnRecursionBehavior()); var children1 = new List <TmServer> { fixture.Create <TmServer>(), fixture.Create <TmServer>() }; var children2 = new List <TmServer> { fixture.Create <TmServer>() }; var tmServer1 = TmServer.CreateFromIfaceServer(ifaceServer); var tmServer2 = TmServer.CreateFromIfaceServer(ifaceServer); tmServer1.Children.AddRange(children1); tmServer2.Children.AddRange(children2); var result = tmServer1 == tmServer2; result.Should().Be(false); }
public void ReturnsTrue(TmNativeDefs.IfaceServer ifaceServer) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var tmServer1 = TmServer.CreateFromIfaceServer(ifaceServer); var tmServer2 = TmServer.CreateFromIfaceServer(ifaceServer); var result = tmServer1.Equals(tmServer2); result.Should().Be(true); }
public void ReturnFalseForNull(TmNativeDefs.IfaceServer ifaceServer) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var tmServer = TmServer.CreateFromIfaceServer(ifaceServer); var result = tmServer.Equals(null); result.Should().Be(false); }
public void ReturnsFalseForWrongComment(byte[] comment, TmNativeDefs.IfaceServer ifaceServer) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var tmServer1 = TmServer.CreateFromIfaceServer(ifaceServer); ifaceServer.Comment = comment; var tmServer2 = TmServer.CreateFromIfaceServer(ifaceServer); var result = tmServer1.Equals(tmServer2); result.Should().Be(false); }
public void ReturnsFalseForWrongResState(TmNativeDefs.IfaceServer ifaceServer) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var tmServer1 = TmServer.CreateFromIfaceServer(ifaceServer); ifaceServer.ResState += 1; var tmServer2 = TmServer.CreateFromIfaceServer(ifaceServer); var result = tmServer1 == tmServer2; result.Should().Be(false); }
public void ReturnsFalseForWrongCreationTime(int creationTimeStamp, TmNativeDefs.IfaceServer ifaceServer) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var tmServer1 = TmServer.CreateFromIfaceServer(ifaceServer); ifaceServer.CreationTime = creationTimeStamp; var tmServer2 = TmServer.CreateFromIfaceServer(ifaceServer); var result = tmServer1.Equals(tmServer2); result.Should().Be(false); }
public void ReturnsFalseForWrongParentProcessId(TmNativeDefs.IfaceServer ifaceServer) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var tmServer1 = TmServer.CreateFromIfaceServer(ifaceServer); ifaceServer.Ppid += 1; var tmServer2 = TmServer.CreateFromIfaceServer(ifaceServer); var result = tmServer1.Equals(tmServer2); result.Should().Be(false); }
public void ReturnsFalseForWrongUsers(TmNativeDefs.IfaceServer ifaceServer) { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); var fixture = new Fixture(); var tmUsers1 = new List <TmUser> { fixture.Create <TmUser>(), fixture.Create <TmUser>() }; var tmUsers2 = new List <TmUser> { fixture.Create <TmUser>() }; var tmServer1 = TmServer.CreateFromIfaceServer(ifaceServer); var tmServer2 = TmServer.CreateFromIfaceServer(ifaceServer); tmServer1.Users.AddRange(tmUsers1); tmServer2.Users.AddRange(tmUsers2); var result = tmServer1 == tmServer2; result.Should().Be(false); }
public static extern bool cfsTraceGetServerData(IntPtr connId, [MarshalAs(UnmanagedType.LPStr)] string serverId, [In, Out] ref TmNativeDefs.IfaceServer ifaceServer, out UInt32 errCode, [In, Out] byte[] errBuf, UInt32 maxErrs);