public void GuardarRegion() { //Arrange //¿Esto esta bien? //Creo que rompe con la idea de que no deben depender de otro test. Aca estariamos dependiendo del test de ObtenerRegiones var regionAnterior = logic.GetAll(); var region = new Region(); region.RegionID = 5; region.RegionDescription = "Rosario"; //No puedo manipular datos de PK y si trato de ingresar una PK duplicada entity lo detecta y detiene el guardado //region = logic.GetOne(4); //region.RegionID = region.RegionID + 1; //Act var regionPosterior = logic.Add(region); //Assert Assert.IsTrue(regionPosterior.Count > regionAnterior.Count); }
static void Main(string[] args) { //ILogic obj = AopProxyFactory.GetProxy<ILogic>(); ILogic obj = AopProxyFactory.GetProxy <ILogic, LogicObject>(); obj.Add(3, 3); obj.Add(-2, 12); int result = obj.Result; obj.ShowResult(); Console.WriteLine("*********************************************"); Console.WriteLine("start performance test, please input invoke times:"); string strTimes = Console.ReadLine(); int times = Convert.ToInt32(strTimes); Stopwatch watcher = new Stopwatch(); watcher.Start(); for (float i = 0; i < times; i++) { obj.Add(i, i); } watcher.Stop(); TimeSpan time = watcher.Elapsed; double total = watcher.Elapsed.TotalMilliseconds; double preTimes = total / times; Console.WriteLine("total: {0} \tPreTimes: {1}", total, preTimes); Console.Read(); }
public IActionResult Post([FromBody] User user) { try { var auxUser = _userLogic.Add(user); return(CreatedAtRoute( routeName: "GetUser", routeValues: new { Id = auxUser.Id }, value: auxUser )); } catch (Exception e) { return(BadRequest(e.Message)); } }
public Response <User> Handle(Request request) { switch (request.Command) { case "Add": return(_logic.Add(request.User)); case "Delete": return(_logic.Remove(request.User)); case "Update": return(_logic.Update(request.User, request.User)); default: throw new ArgumentException(); } }
public void SaveUser() { try { var userMigration = _migration.GiveMeUser(); long idMigration = userMigration.RootFolder.Id; userMigration.RootFolder = null; userMigration.FriendList = null; userMigration.Id = 0; var user = _userLogic.Add(userMigration); user.Id = _userLogic.GetUserId(user.Username); var tuple = Tuple.Create <string, long>(user.RootFolder.Name, idMigration); mapName.Add(tuple); Owner = user; } catch (Exception e) { throw new Exception("The format is not correct: " + e.Message); } }
public ActionResult SubmitAdd(AddModel addModel) { if (ModelState.IsValid && _logic.GetFromUser(GetIdFromUser()) .Where(a => a.Key == addModel.Key).Count() == 0 && GetIdFromUser() != Guid.Empty) { Entry entry = new Entry() { Changed = DateTime.Now, Email = addModel.Email, Key = addModel.Key, Notes = addModel.Notes, Password = addModel.Password, UserId = GetIdFromUser() }; _logic.Add(entry); return(RedirectToAction("Overview")); } ViewBag.Feedback = "used key"; return(View("add", model: addModel)); }
public void PostEntry([FromBody] Entry entry) => _logic.Add(entry);
public void AddUserNull() { userLogic.Add(userNull); }