public void Account_create_with_overdraft() { //arrange Account a = new Omni(1000, (decimal).10, 10, 100); //act decimal expected = 100; decimal actual = a.OverdraftLimit; //assert Assert.AreEqual(expected, actual); }
public void Account_withdraw_within_overdraft_limit() { //arrange Account a = new Omni(1000, (decimal).10, 10, 100); //act a.Withdraw(1050); //assert decimal expected = -50; decimal actual = a.Balance; Assert.AreEqual(expected, actual); }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); try { //Application.Run(new main_window()); omni = new Omni(Process.GetCurrentProcess().Handle); //Initialize Torque, pass a handle to this form into T3D so it knows where to rendor the screen to. //If you don't do this, you can't pass the mouse and key strokes, w/out the mouse and keystrokes //being redirected the application will hang intermittently. #if DEBUG omni.Initialize(MessageBox.Show("Dedicated", "Dedicated", MessageBoxButtons.YesNo) == DialogResult.Yes ? new[] { "-dedicated", "-mission", @"levels/Empty_Terrain.mis" } : new[] { "" }, "<!!__PROJECTNAME__!!>_DEBUG", "WinterLeaf.Demo.Full.dll", "WinterLeaf.Demo.Full", "csScripts"); #else omni.Initialize(MessageBox.Show("Dedicated", "Dedicated", MessageBoxButtons.YesNo) == DialogResult.Yes ? new[] { "-dedicated", "-mission", @"levels/Empty_Terrain.mis" } : new[] { "" }, "<!!__PROJECTNAME__!!>", "WinterLeaf.Demo.Full.dll", "WinterLeaf.Demo.Full", "csScripts"); #endif omni.Debugging = false; omni.ScriptExtensions_Allow = true; omni.ScriptExtensions_HandleExceptions = true; omni.DebuggingShowScriptCalls = false; omni.WindowIcon = new Icon("Omni.ico"); while (omni.IsRunning) { Thread.Sleep(1000); } if (omni.LastError != null) { MessageBox.Show("An Error has occurred in the application. " + omni.LastError); } omni = null; } catch (Exception err) { MessageBox.Show("An Error has occurred in the application. " + err.Message); } Application.Exit(); }
// POST /Omni/token/ public HttpResponseMessage Post(string token, [FromBody] Omni param) { try { HttpResponseMessage retorno = new HttpResponseMessage(); if (Permissoes.Autenticado(token)) { return(Request.CreateResponse <Int32>(HttpStatusCode.OK, GatewayOmni.Add(token, param))); } else { return(Request.CreateResponse(HttpStatusCode.Unauthorized)); } } catch { throw new HttpResponseException(HttpStatusCode.InternalServerError); } }
public override void LoadData() { if (_isNewOmni) { CurrentOmni = new Omni { DateCreated = DateTime.Now, LastModifiedDate = DateTime.Now }; } else { CurrentOmni = Context.Omnis.Single(o => o.Id == _omniID); } OmniSummary = CurrentOmni.Summary; OmniDescription = CurrentOmni.Description; CurrentOmniLastUpdatedTime = CurrentOmni.LastModifiedDate; OmniTags = CurrentOmni.Tags.ToList(); OmniImages = new ObservableCollection <Image>(CurrentOmni.Images.ToList()); var ibvmList = OmniTags.Select(t => new TagButtonViewModel(t)); ImageButtons = new ObservableCollection <TagButtonViewModel>(ibvmList); string avtStr = Context.GetSettingOrDefault(Setting.AutoTagVerificationThreshold, "5").Value; if (!Int32.TryParse(avtStr, out _autoVerifyThreshold)) { _autoVerifyThreshold = 5; } _imageTempDirectory = Context.GetSettingOrDefault(Setting.EmbeddedImageTempDirectory, OmniTextRenderer.DefaultEmbeddedImageLocation).Value; TagNameList = Context.Tags.Select(t => t.Name).ToList(); }
public void Account_withdraw_outside_overdraft_limit() { //arrange Account a = new Omni(1000, (decimal).10, 10, 100); //act string actual; try { actual = a.Withdraw(1150); Assert.Fail(); // should throw exception, if code reaches here fail test } catch (Exception e) { actual = e.Message; } //assert string expected = "Omni " + a.ID.ToString() + "; withdrawal $1150; transaction failed; fee 10; balance $990"; Assert.AreEqual(expected, actual); }
/// <summary> /// /// </summary> /// <param name="ts"></param> public GuiAutoScrollCtrlObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GroundPlaneObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GameBaseObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public ForestSelectionToolObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public ForestBrushToolObject(ref Omni ts){m_ts = ts;}
/// <summary> /// Altera Omni /// </summary> /// <param name="param"></param> /// <returns></returns> public static void Update(string token, Omni param) { Omni value = _db.Omnis .Where(e => e.id.Equals(param.id)) .First <Omni>(); // OBSERVAÇÂO: VERIFICAR SE EXISTE ALTERAÇÃO NO PARAMETROS if (param.id != null && param.id != value.id) { value.id = param.id; } if (param.dtaTransacao != null && param.dtaTransacao != value.dtaTransacao) { value.dtaTransacao = param.dtaTransacao; } if (param.descricao != null && param.descricao != value.descricao) { value.descricao = param.descricao; } if (param.produto != null && param.produto != value.produto) { value.produto = param.produto; } if (param.numCpf != null && param.numCpf != value.numCpf) { value.numCpf = param.numCpf; } if (param.numCartao != null && param.numCartao != value.numCartao) { value.numCartao = param.numCartao; } if (param.valorTotal != null && param.valorTotal != value.valorTotal) { value.valorTotal = param.valorTotal; } if (param.metodo != null && param.metodo != value.metodo) { value.metodo = param.metodo; } if (param.situacao != null && param.situacao != value.situacao) { value.situacao = param.situacao; } if (param.cdAutorizacao != null && param.cdAutorizacao != value.cdAutorizacao) { value.cdAutorizacao = param.cdAutorizacao; } if (param.usuario != null && param.usuario != value.usuario) { value.usuario = param.usuario; } if (param.cnpj != null && param.cnpj != value.cnpj) { value.cnpj = param.cnpj; } if (param.idOperadora != null && param.idOperadora != value.idOperadora) { value.idOperadora = param.idOperadora; } if (param.idBandeira != null && param.idBandeira != value.idBandeira) { value.idBandeira = param.idBandeira; } if (param.dtaRecebimento != null && param.dtaRecebimento != value.dtaRecebimento) { value.dtaRecebimento = param.dtaRecebimento; } if (param.idTerminalLogico != null && param.idTerminalLogico != value.idTerminalLogico) { value.idTerminalLogico = param.idTerminalLogico; } _db.SaveChanges(); }
/// <summary> /// /// </summary> /// <param name="ts"></param> public GuiClockHudObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GuiButtonBaseCtrlObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public DebrisObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GuiCheckBoxCtrlObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public DebugDrawerObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GuiControlObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public DecalDataObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public ForestObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public DecalRoadObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public ForestEditorCtrlObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public DynamicConsoleMethodComponentObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public ForestWindEmitterObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public EditTSCtrlObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GameConnectionObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public EventManagerObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GuiAutoCompleteCtrlObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public FieldBrushObjectObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GuiBitmapCtrlObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public FileDialogObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GuiCanvasObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public FileObjectObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GuiChunkedBitmapCtrlObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public FileStreamObjectObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public GuiColorPickerCtrlObject(ref Omni ts){m_ts = ts;}
/// <summary> /// /// </summary> /// <param name="ts"></param> public FlyingVehicleObject(ref Omni ts){m_ts = ts;}
public OmniImageViewModel(Omni omni, OmniTagContext context) { CurrentOmni = omni; Context = context; }
/// <summary> /// Adiciona nova Omni /// </summary> /// <param name="param"></param> /// <returns></returns> public static Int32 Add(string token, Omni param) { _db.Omnis.Add(param); _db.SaveChanges(); return(param.id); }