public void isValid() { NotNullValidator val = new NotNullValidator(); ictl = rep.Stub <iControl>(); Expect.On(ictl).Call(ictl.getValue()).Return(String.Empty); rep.ReplayAll(); Assert.IsTrue(val.isValid(ictl)); }
private void addClass(System.Windows.Forms.ListBox lb, iControl.LocalLBClassClassType type) { DataGroupDialog dlg = new DataGroupDialog(); dlg.m_type = type; dlg.m_mode = DataGroupDialog.DialogMode.DIALOGMODE_NEW; DialogResult dr = dlg.ShowDialog(); if (DialogResult.OK == dr) { lb.Items.Add(dlg.m_name); } }
/// <summary> /// The Method to apply the style manager style to the added controls. /// </summary> private void ControlAdded(object sender, ControlEventArgs e) { if (e.Control is iControl && CustomTheme != null) { iControl control = (iControl)e.Control; control.Style = Style; control.ThemeAuthor = ThemeAuthor; control.ThemeName = ThemeName; control.StyleManager = this; } else { UpdateForm(); } }
public static bool uploadFile(iControl.Interfaces interfaces, string remote_file_path, string file_contents) { bool bUploaded = false; bool bContinue = true; long chunk_size = 64 * 1024; iControl.SystemConfigSyncFileTransferContext ftc = new iControl.SystemConfigSyncFileTransferContext(); ftc.chain_type = iControl.CommonFileChainType.FILE_FIRST; long total_bytes = 0; System.Text.ASCIIEncoding encoding = new ASCIIEncoding(); string chunk = null; long chunk_length = 0; long file_length = file_contents.Length; if (interfaces.initialized) { while (bContinue) { chunk_length = chunk_size; if ( chunk_length > file_length-total_bytes ) { chunk_length = file_length - total_bytes; } chunk = file_contents.Substring((int)total_bytes, (int)chunk_length); if (chunk.Length != chunk_size) { if (0 == total_bytes) { ftc.chain_type = iControl.CommonFileChainType.FILE_FIRST_AND_LAST; } else { ftc.chain_type = iControl.CommonFileChainType.FILE_LAST; } bContinue = false; } ftc.file_data = encoding.GetBytes(chunk); total_bytes += chunk.Length; // Upload bytes interfaces.SystemConfigSync.upload_file(remote_file_path, ftc); ftc.chain_type = iControl.CommonFileChainType.FILE_MIDDLE; } } bUploaded = (total_bytes > 0); return bUploaded; }
public static string downloadFile(iControl.Interfaces interfaces, string remote_file) { long chunk_size = 64 * 1024; long file_offset = 0; bool bContinue = true; string file_contents = ""; System.IO.StringWriter sw = new System.IO.StringWriter(); if (interfaces.initialized) { iControl.SystemConfigSyncFileTransferContext ftc = new iControl.SystemConfigSyncFileTransferContext(); while (bContinue) { ftc = interfaces.SystemConfigSync.download_file(remote_file, chunk_size, ref file_offset); file_contents += System.Text.ASCIIEncoding.ASCII.GetString(ftc.file_data); if ((ftc.chain_type == iControl.CommonFileChainType.FILE_LAST) || (ftc.chain_type == iControl.CommonFileChainType.FILE_FIRST_AND_LAST)) { bContinue = false; } } } return file_contents; }
private void editClass(System.Windows.Forms.ListBox lb, iControl.LocalLBClassClassType type) { int index = lb.SelectedIndex; if (-1 != index) { DataGroupDialog dlg = new DataGroupDialog(); dlg.m_type = type; dlg.m_name = lb.Items[index].ToString(); dlg.m_mode = DataGroupDialog.DialogMode.DIALOGMODE_EDIT; DialogResult dr = dlg.ShowDialog(); } }
public void setup() { rep = new MockRepository(); iCtl = rep.Stub <iControl>(); ctl = (System.Windows.Forms.Control)rep.StrictMock(typeof(System.Windows.Forms.Control)); }
private UInt64 build64(iControl.CommonULong64 ul64) { return (UInt64)((UInt64)(ul64.high<<32) | (UInt64)ul64.low); }
private bool isEof(iControl.SystemConfigSyncFileTransferContext ctx) { bool bEof = true; if (null != ctx) { if ((ctx.chain_type == iControl.CommonFileChainType.FILE_LAST) || (ctx.chain_type == iControl.CommonFileChainType.FILE_FIRST_AND_LAST)) { bEof = true; } else { bEof = false; } } return bEof; }
public void TearDown() { ictl = null; rep = null; }
public void setup() { rep = new MockRepository(); ictl = rep.Stub <iControl>(); }
public UInt64 toUint64(iControl.CommonULong64 ul64) { UInt64 ui64 = (Convert.ToUInt64(ul64.high)<<32) | (Convert.ToUInt64(ul64.low)); return ui64; }