public void ThrowsExceptionWhenTryingToFetchDeletedEntity() { using (_container.BeginScope()) { var aggregates = _container.Resolve <IEventStoreSession>(); var accountId = Guid.Parse("00000000-0000-0000-0000-000000000001"); MyAccount registered; using (var transaction = _container.BeginTransactionalUnitOfWorkScope()) { registered = MyAccount.Register(aggregates, accountId, "email", "password"); transaction.Commit(); } var reader = _container.Resolve <IDocumentDbReader>(); reader.Get <MyAccountQueryModel>(registered.Id);//Here it exists using (var transaction = _container.BeginTransactionalUnitOfWorkScope()) { registered.Delete(); transaction.Commit(); } using (_container.BeginScope()) { var reader2 = _container.Resolve <IDocumentDbReader>(); reader2.Invoking(me => me.Get <MyAccountQueryModel>(registered.Id)) .ShouldThrow <Exception>(); } } }
private void btn_cancel_Click(object sender, EventArgs e) { this.Hide(); MyAccount myAccount = new MyAccount(); myAccount.ShowDialog(); }
public void CanFetchQueryModelAfterAggregateHasBeenCreated() { using (_container.BeginScope()) { var aggregates = _container.Resolve <IEventStoreSession>(); var accountId = Guid.Parse("00000000-0000-0000-0000-000000000001"); MyAccount registered; using (var transaction = _container.BeginTransactionalUnitOfWorkScope()) { registered = MyAccount.Register(aggregates, accountId, "email", "password"); transaction.Commit(); } registered.Email.Should().Be("email"); registered.Password.Should().Be("password"); var reader = _container.Resolve <IDocumentDbReader>(); var loadedModel = reader.Get <MyAccountQueryModel>(registered.Id); loadedModel.Should().NotBe(null); loadedModel.Id.Should().Be(accountId); loadedModel.Email.Should().Be(registered.Email); loadedModel.Password.Should().Be(registered.Password); } }
public Task <long> MyDevices_Insert(string session, string name, string value) { var yield = new TaskCompletionSource <long>(); Console.WriteLine("enter MyDevices_Insert"); this.account.SelectByCookie( new MyAccountQueries.SelectByCookie { cookie = session }, r => { long account = r.id; this.MyDevices.account = account; this.MyDevices.MyDevices_Insert( //"" + account, name, value ).ContinueWithResult(yield.SetResult); } ); Console.WriteLine("exit MyDevices_Insert"); return(yield.Task); }
public void VerifyRetrievalOfSavedSearchResults() { _driver.Navigate().GoToUrl(_configuration.MyAccountUrl); _myAccountPage = new MyAccount(); PageFactory.InitElements(_driver, _myAccountPage); _myAccountPage.RetrieveSavedSearchResults(); }
public void AfterIConnectWithAgent_IAmConnectedToAgent() { MyActor.Connect(OtherId); Assert.NotNull(MyAccount.GetPeer(OtherId)); Assert.True(MyAccount.IsConnectedTo(OtherId)); }
public Task MyDevices_SelectByAccount(string session, Action <long, string, string> yield) { var done = new TaskCompletionSource <long>(); // ex = {"{ Message = database is locked\r\ndatabase is locked, StackTrace = at System.Data.SQLite.SQLite3.Step(SQLiteStatement stmt)\r\n at System.Data.SQLite.SQLiteDataReader.NextResult()\r\n at System.Data.SQLite.SQLiteDataReader..ctor(SQLiteCommand cmd, ... Console.WriteLine("enter MyDevices_SelectByAccount"); this.account.SelectByCookie( new MyAccountQueries.SelectByCookie { cookie = session }, r => { long account = r.id; this.MyDevices.account = account; this.MyDevices.MyDevices_SelectByAccount( //"" + account, yield ).ContinueWith( delegate { done.SetResult(0); } ); } ); Console.WriteLine("exit MyDevices_SelectByAccount"); return(done.Task); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { try { name = Session["name"].ToString(); money = Convert.ToSingle(Session["money_pay"].ToString()); //获取用户的账户余额 myaccount = new MyAccountDAO().getMyAccount(name); if (myaccount == null) { myaccount = new MyAccount(); myaccount.Name = name; myaccount.Balance = 0; way_one.Visible = false; only_for_read.Visible = true; } else { if (myaccount.Balance < money) { way_one.Visible = false; only_for_read.Visible = true; } } } catch (Exception ex) { Response.Redirect("error-page.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["name"] == null || Session["money_pay"] == null) { Response.Redirect("error-page.aspx"); } else { name = Session["name"].ToString(); money = Convert.ToSingle(Session["money_pay"].ToString()); myaccount = new MyAccountDAO().getMyAccount(name); if (myaccount == null) { Response.Redirect("error-page.aspx"); } else if (myaccount.Balance < money) { Response.Redirect("error-page.aspx"); } else { if (Session["success_code"] == null) { Response.Redirect("error-page.aspx"); } } } }
public void ReturnsUpdatedDataAfterTransactionHasCommitted() { using (_container.BeginScope()) { var accountId = Guid.Parse("00000000-0000-0000-0000-000000000001"); MyAccount registered; var aggregates = _container.Resolve <IEventStoreSession>(); using (var transaction = _container.BeginTransactionalUnitOfWorkScope()) { registered = MyAccount.Register(aggregates, accountId, "email", "password"); transaction.Commit(); } _container.Resolve <IDocumentDbReader>() .Get <MyAccountQueryModel>(registered.Id); //Make sure we read it once so caches etc get involved. using (var transaction = _container.BeginTransactionalUnitOfWorkScope()) //Update it. { registered.ChangeEmail("newEmail"); transaction.Commit(); } using (_container.BeginScope()) { var loadedModel = _container.Resolve <IDocumentDbReader>() .Get <MyAccountQueryModel>(registered.Id); loadedModel.Should().NotBe(null); loadedModel.Email.Should().Be("newEmail"); } } }
void SeelectedItem(object sender, EventArgs e) { var l = ListView1.SelectedItem as List; if (l.Title == "My ACCOUNT") { Detail = new MyAccount(); IsPresented = false; } if (l.Title == "Shop") { Detail = new Shop(); IsPresented = false; } if (l.Title == "FAQ") { Detail = new FAQ(); IsPresented = false; } if (l.Title == "Notification") { Detail = new Notification(); IsPresented = false; } }
public void WhenSyncPeer_ThenUpdateFromConnectedPeersAndWeighBySumOfTheirTrust( float peerMoneyBefore, float[] peerTrusts, int[] peerAssessments, float peerMoneyAfter) { var peers = peerTrusts .Select((pt, i) => _network .CreateRootAccount($"Peer{i}", (byte)(10 + i)) .GetActor(_network, new TransactionFactory())) .ToArray(); int i = 0; var peerToUpdate = peers[0]; foreach (var peer in peers) { Interconnect(MyActor, peer); MyAccount.SetTrust(peer.Account.Id, (SignedWeight)peerTrusts[i]); var peerAssessment = peerAssessments[i]; if (peerAssessment >= 0) { Interconnect(peer, peerToUpdate); peer.Account.SetMoney(peerToUpdate.Account.Id, (Money)peerAssessments[i]); } i++; } MyAccount.SetMoney(peerToUpdate.Account.Id, (Money)peerMoneyBefore); MyActor.SyncAll(); Assert.Equal(peerMoneyAfter, MyAccount.GetMoney(peerToUpdate.Account.Id)); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Session["name"] = "yangwang"; if (Session["name"] == null) { Response.Redirect("../error-page.aspx"); } else { MyAccount temp = new MyAccountDAO().getMyAccount(Session["name"].ToString()); if (temp == null) { myaccount.Balance = 0; myaccount.Name = Session["name"].ToString(); } else { myaccount = temp; } } } }
public void WhenDecreaseTrustWithFactor_OutOfBounds_ThrowsOutOfBoundsException( float trustBefore, float factor) { MyActor.Connect(OtherId); MyAccount.SetTrust(OtherId, (SignedWeight)trustBefore); Assert.Throws <OutOfBounds <float> >(() => MyAccount.DecreaseTrust(OtherId, (Weight)factor)); }
public void CanIncreaseTrustWithFactor(float trustBefore, float factor, float trustAfter) { MyActor.Connect(OtherId); MyAccount.SetTrust(OtherId, (SignedWeight)trustBefore); MyAccount.IncreaseTrust(OtherId, (Weight)factor); Assert.Equal((SignedWeight)trustAfter, MyAccount.GetTrust(OtherId)); }
public async Task <IActionResult> UpdateAccount(Guid id, [FromBody] MyAccount data) { var identity = GetCurrentIdentity(); if (!identity.isServerAdmin) { return(Forbid()); } var updateIdentity = db.GetEndpointIdentityByGuid(id); if (updateIdentity == null) { return(NotFound()); } updateIdentity.contact = data.contact; updateIdentity.name = data.name; updateIdentity.accessIdentity = data.accessIdentities; updateIdentity.isServerAdmin = data.isServerAdmin; db.UpdateEndpointInDatastore(updateIdentity); data.id = updateIdentity.uid; return(Ok(data)); }
public void MYAcco() { // Creates a toggle for the given test, adds all log events under it test = extent.StartTest("my account", "verify user able to save his account in Grabone"); MyAccount MYacctobj = new MyAccount(); MYacctobj.Account(); }
public async Task UpdateAccount() { _account = JsonConvert.DeserializeObject <MyAccount>(await HttpUtil.GetAsync(JsonApiEndpoints.GetFullUrl(JsonApiEndpoints.MY_ACCOUNT))); var friendsJson = await HttpUtil.GetAsync(JsonApiEndpoints.GetFullUrl(JsonApiEndpoints.ACCEPTED_CONVERSATIONS)); _acceptedConversations = JsonConvert.DeserializeObject <List <AcceptedConversation> >(friendsJson); }
public static void MainMethod() { var myAccount = new MyAccount("Stephen", "Hell0!", "What is your first school?", "St Michaels"); var password = myAccount.Password; Console.WriteLine("hello"); }
public void CanSetAndGetTrustOfPeer(float trustValue) { var trust = (SignedWeight)trustValue; MyActor.Connect(OtherId); MyAccount.SetTrust(OtherId, trust); Assert.Equal(trust, MyAccount.GetTrust(OtherId)); }
/// <summary> /// Method open MyAccount DropDown menu if closed /// </summary> public void OpenMyAccountDropDownMenu() { if (MyAccount.GetAttribute(ARIA_EXPANDED_ATTRIBUTE) != "true") { MyAccount.Click(); } myAccountDropDownMenu = new MyAccountDropDownMenu(driver); }
public void WhenTryGetNonExistingPeer_ThrowsNotFoundPeer() { var id = (AgentId)"255"; var ex = Assert.Throws <NotFound <IPeer> >(() => MyAccount.GetPeer(id)); Assert.Contains(id.ToString(), ex.Message); Assert.Equal("id", ex.ParamName); }
public ActionResult DeleteConfirmed(int id) { MyAccount myAccount = db.MyAccounts.Find(id); db.MyAccounts.Remove(myAccount); db.SaveChanges(); return(RedirectToAction("Index")); }
public void AfterSetMoney_PeerHasMoney(float initialMoney, float setMoney, float hasMoney) { MyActor.Connect(OtherId); MyAccount.SetMoney(OtherId, (Money)initialMoney); MyAccount.SetMoney(OtherId, (Money)setMoney); Assert.Equal(hasMoney, MyAccount.GetMoney(OtherId)); }
public void CanRenewAccountKeys() { var keyBefore = MyAccount.PublicKey; MyAccount.RenewKeys(); var keyAfter = MyAccount.PublicKey; Assert.NotEqual(keyBefore, keyAfter); }
public ConnectApiHandler(IConnectionManager connectionManager, ILoginHandler loginHandler, IExceptionHandler exHandler) { _connectionManager = connectionManager; _loginHandler = loginHandler; _exHandler = exHandler; Me = new MyAccount(); _mappingEngine = GetMapper(); SetupListeners(); }
private void lv_Accounts_SelectionChanged(object sender, SelectionChangedEventArgs e) { var avm = lv_Accounts.SelectedItem as AccountViewModel; if (avm != null) { _myAccount = avm.Account; btn_Edit.IsEnabled = true; } }
public void WhenMyPeerCreateChild_IConnectWithChild() { const string childName = "child"; Interconnect(MyActor, OtherActor); var newAccount = OtherActor.CreateAccount(childName); Assert.True(MyAccount.IsConnectedTo(newAccount.Id)); }
public void WhenEndorcePeerManyTimes_MoneyIncreaseLessThanTwo() { Interconnect(MyActor, OtherActor, ThirdActor); MyAccount.SetTrust(OtherId, SignedWeight.Max); for (int i = 0; i < 100; i++) { OtherActor.Endorce(ThirdId); } Assert.InRange(MyAccount.GetMoney(ThirdId), 1f, 2f); }
public void ThenIShouldBeNaviagtedToMyAccountPage() { Assert.IsFalse(si.isAuthenticationFailedDisplayed()); MyAccount myacc = new MyAccount(driver); Assert.IsTrue(myacc.isAuthenticationSuccessful()); test.Log(LogStatus.Pass, "Step details"); }
/// <summary> /// On click handler /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void buttonRegister_Click(object sender, EventArgs e) { // collect account data from windows form MyAccount acc = new MyAccount(this); // clean previous accounts (if any) registrar.Config.Accounts.Clear(); // add account data holder to proxy! registrar.Config.Accounts.Add(acc); this.textBoxStatus.Text = "Waiting status..."; this.Refresh(); // send register request registrar.registerAccounts(); }