public void AddChirpTest() { IChirpyRRepository repository = new ChirpyRSqlRepository("ChirpyRConnection", "dbo"); ChirpyRDataService target = new ChirpyRDataService(repository); Chirp newChirp = new Chirp { Text = "Test Chirp", ChirpTime = DateTime.Now, }; long notExpected = -1; long actual; actual = target.AddChirp(newChirp); Assert.AreNotEqual(notExpected, actual); }
// POST api/chirpyr public void Post(Chirp model) { if (ModelState.IsValid) { //_repository.AddChirp(model); var hubContext = GlobalHost .ConnectionManager .GetHubContext<ChirpyRHub>(); model.ChirpBy = new ChirpyRUser { UserId = this.User != null && this.User.Identity != null ? this.User.Identity.Name : "(none)", Gravataar = @"http://www.gravatar.com/avatar/147bacafcdb00d67d3336ecdf4078ba5.png" }; hubContext.Clients.NewChirp(model); } }
// POST api/chirpyr public void Post(Chirp model) { if (ModelState.IsValid) { //_repository.AddChirp(model); var hubContext = GlobalHost .ConnectionManager .GetHubContext<ChirpyRHub>(); var member = Membership.GetUser(); model.ChirpBy = new ChirpyRUser { UserId = this.User != null && this.User.Identity != null ? this.User.Identity.Name : "(none)", Gravataar = string.Format("http://www.gravatar.com/avatar/{0}?d=identicon", this.CreateMD5Hash(member.Email)) }; hubContext.Clients.NewChirp(model); } }