public void SamrEnumerateDomainsInSamServer_SUCCESS_NonDC() { HRESULT hResult; IChecker PtfAssert = TestClassBase.BaseTestSite.Assert; Site.Log.Add(LogEntryKind.TestStep, string.Format("SamrBind, Server:{0}, Domain:{1}, User:{2}, Password{3}.", _samrProtocolAdapter.domainMemberFqdn, _samrProtocolAdapter.domainMemberNetBIOSName, _samrProtocolAdapter.DMAdminName, _samrProtocolAdapter.DMAdminPassword)); _samrProtocolAdapter.SamrBind( _samrProtocolAdapter.domainMemberFqdn, _samrProtocolAdapter.domainMemberNetBIOSName, _samrProtocolAdapter.DMAdminName, _samrProtocolAdapter.DMAdminPassword, false, false); Site.Log.Add(LogEntryKind.TestStep, string.Format("SamrConnect5, Server:{0}, Desired Access: SAM_SERVER_ENUMERATE_DOMAINS.", _samrProtocolAdapter.domainMemberFqdn)); hResult = (HRESULT)_samrProtocolAdapter.SamrConnect5( _samrProtocolAdapter.domainMemberFqdn, (uint)SERVER_ACCESS_MASK.SAM_SERVER_ENUMERATE_DOMAINS, out _serverHandle); PtfAssert.AreEqual(HRESULT.STATUS_SUCCESS, hResult, "SamrConnect5 must return STATUS_SUCCESS."); uint?enumerationContext = 0; uint countReturned; _SAMPR_ENUMERATION_BUFFER?enumerationBuffer; Site.Log.Add(LogEntryKind.TestStep, "SamrEnumerateDomainsInSamServer, PreferedMaximumLength: 1024."); hResult = (HRESULT)SAMRProtocolAdapter.RpcAdapter.SamrEnumerateDomainsInSamServer( _serverHandle, ref enumerationContext, out enumerationBuffer, 1024, out countReturned); PtfAssert.AreEqual(HRESULT.STATUS_SUCCESS, hResult, "SamrEnumerateDomainsInSamServer must return STATUS_SUCCESS."); PtfAssert.AreNotEqual <uint>(0, countReturned, "The CountReturned is not zero."); PtfAssert.IsNotNull(enumerationBuffer, "EnumerationBuffer is not null."); PtfAssert.AreEqual <uint>(countReturned, enumerationBuffer.Value.EntriesRead, "Verify the EntriesRead property."); bool builtInDomainFound = false; foreach (var entry in enumerationBuffer.Value.Buffer) { string name = DtypUtility.ToString(entry.Name); if (string.Compare(name, "BUILTIN", true) == 0) { builtInDomainFound = true; } PtfAssert.AreEqual <uint>(0, entry.RelativeId, "[MS-SAMR]3.1.5.2.1 Buffer.Buffer.RelativeId is 0."); } PtfAssert.IsTrue(builtInDomainFound, "Client obtains a listing, without duplicates, of the name attribute of the built-in domain object."); }