public void DRSR_DRSReplicaDel_Failed_InvalidDsaSrc()
        {
            DrsrTestChecker.Check();
            NeedRepSourceUpdate need = new NeedRepSourceUpdate(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2, NamingContext.ConfigNC);

            UpdatesStorage.GetInstance().PushUpdate(need);
            drsTestClient.SyncDCs(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2);

            drsTestClient.DrsBind(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.User.ParentDomainAdmin, DRS_EXTENSIONS_IN_FLAGS.DRS_EXT_BASE);

            DRS_MSG_REPDEL req = GenerateReplicaDelReq(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2);

            BaseTestSite.Log.Add(LogEntryKind.Checkpoint, "Set pszDsaSrc to \"x\"");
            req.V1.pszDsaSrc = "x";
            uint ret = drsTestClient.DRSClient.DrsReplicaDel(EnvironmentConfig.DrsContextStore[EnvironmentConfig.Machine.WritableDC1], 1, req);

            if (EnvironmentConfig.TestDS)
            {
                BaseTestSite.Assert.AreEqual <uint>((uint)Win32ErrorCode_32.ERROR_DS_DRA_NO_REPLICA, ret, "server should return ERROR_DS_DRA_NO_REPLICA if pszDsaSrc is invalid");
            }
            else
            {
                BaseTestSite.Assert.AreEqual <uint>((uint)Win32ErrorCode_32.ERROR_DS_DRA_INVALID_PARAMETER, ret, "server should return ERROR_DS_DRA_INVALID_PARAMETER if pszDsaSrc is invalid");
            }
        }
        public void DRSR_DRSReplicaDel_V1_With0x1000Flag()
        {
            DrsrTestChecker.Check();
            NeedRepSourceUpdate need = new NeedRepSourceUpdate(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2, NamingContext.ConfigNC);

            UpdatesStorage.GetInstance().PushUpdate(need);

            drsTestClient.SyncDCs(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2);

            uint ret = drsTestClient.DrsBind(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.User.ParentDomainAdmin, DRS_EXTENSIONS_IN_FLAGS.DRS_EXT_BASE);

            drsTestClient.DrsReplicaDel(EnvironmentConfig.Machine.WritableDC1, (DsServer)EnvironmentConfig.MachineStore[EnvironmentConfig.Machine.WritableDC2], DRS_OPTIONS.DRS_LOCAL_ONLY);
        }
        public void DRSR_DRSReplicaDel_Failed_WithNormalUser()
        {
            DrsrTestChecker.Check();
            NeedRepSourceUpdate need = new NeedRepSourceUpdate(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2, NamingContext.ConfigNC);

            UpdatesStorage.GetInstance().PushUpdate(need);
            drsTestClient.SyncDCs(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2);

            drsTestClient.DrsBind(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.User.ParentDomainUser, DRS_EXTENSIONS_IN_FLAGS.DRS_EXT_BASE);

            uint ret = drsTestClient.DrsReplicaDel(EnvironmentConfig.Machine.WritableDC1, (DsServer)EnvironmentConfig.MachineStore[EnvironmentConfig.Machine.WritableDC2], DRS_OPTIONS.DRS_ASYNC_OP, NamingContext.ConfigNC);

            BaseTestSite.Assert.AreEqual <uint>((uint)Win32ErrorCode_32.ERROR_DS_DRA_ACCESS_DENIED, ret, "");
        }
        public void DRSR_DRSReplicaModify_V1_Success()
        {
            DrsrTestChecker.Check();
            NeedRepSourceUpdate need = new NeedRepSourceUpdate(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2, NamingContext.ConfigNC);

            UpdatesStorage.GetInstance().PushUpdate(need);

            BaseTestSite.Assert.IsTrue(drsTestClient.SyncDCs(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2),
                                       "IDL_DRSReplicaModify: need to sync DCs first");

            uint ret = drsTestClient.DrsBind(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.User.ParentDomainAdmin, DRS_EXTENSIONS_IN_FLAGS.DRS_EXT_BASE);

            drsTestClient.DrsReplicaModify(EnvironmentConfig.Machine.WritableDC1, (DsServer)EnvironmentConfig.MachineStore[EnvironmentConfig.Machine.WritableDC2], DRS_OPTIONS.DRS_WRIT_REP, DRS_MSG_REPMOD_FIELDS.DRS_UPDATE_ADDRESS | DRS_MSG_REPMOD_FIELDS.DRS_UPDATE_FLAGS | DRS_MSG_REPMOD_FIELDS.DRS_UPDATE_SCHEDULE, 0);
        }
        public void DRSR_DRSReplicaDel_Failed_InvalidNC()
        {
            DrsrTestChecker.Check();
            NeedRepSourceUpdate need = new NeedRepSourceUpdate(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2, NamingContext.ConfigNC);

            UpdatesStorage.GetInstance().PushUpdate(need);
            drsTestClient.SyncDCs(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2);

            drsTestClient.DrsBind(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.User.ParentDomainAdmin, DRS_EXTENSIONS_IN_FLAGS.DRS_EXT_BASE);

            DRS_MSG_REPDEL req = GenerateReplicaDelReq(EnvironmentConfig.Machine.WritableDC1, EnvironmentConfig.Machine.WritableDC2);

            BaseTestSite.Log.Add(LogEntryKind.Checkpoint, "Set pNC to default empty DSNAME");
            req.V1.pNC = DrsuapiClient.CreateDsName(null, Guid.Empty, null);
            uint ret = drsTestClient.DRSClient.DrsReplicaDel(EnvironmentConfig.DrsContextStore[EnvironmentConfig.Machine.WritableDC1], 1, req);

            BaseTestSite.Assert.AreEqual <uint>((uint)Win32ErrorCode_32.ERROR_DS_DRA_BAD_NC, ret, "server should return ERROR_DS_DRA_BAD_NC if pNC is invalid but not null");
        }