Example #1
0
        public void CfConnectSyncRootTest()
        {
            const string dest        = "CfDest";
            var          destDirPath = SetupTempDir(dest);

            try
            {
                using var csp = new CloudSyncProvider(destDirPath, "TestSync");
                csp.Status    = CF_SYNC_PROVIDER_STATUS.CF_PROVIDER_STATUS_IDLE;
                csp.Status.WriteValues();

                const string desc    = "SyncStatus is good.";
                uint         descLen = (uint)(desc.Length + 1) * 2;
                var          ss      = new CF_SYNC_STATUS {
                    StructSize = (uint)Marshal.SizeOf <CF_SYNC_STATUS>() + descLen, Code = 1, DescriptionLength = descLen
                };
                var mem = new SafeHGlobalHandle(Marshal.SizeOf <CF_SYNC_STATUS>() + descLen);
                mem.Write(ss);
                StringHelper.Write(desc, ((IntPtr)mem).Offset(Marshal.SizeOf <CF_SYNC_STATUS>()), out _, true, CharSet.Unicode, descLen);
                Assert.That(CfReportSyncStatus(destDirPath, mem), ResultIs.Successful);
            }
            finally
            {
                DeleteTempDir(dest);
            }
        }