public async Task ShutDown() { if (!config.OwnerIds.Contains(Context.User.Id)) { await RespondAsync(":no_good::skin-tone-3: You don't have permission to run this command!"); return; } events.Save(); config.Save(); await ReplyAsync("rip"); await Context.Client.LogoutAsync(); await Task.Delay(1000); Environment.Exit((int)ExitCodes.ExitCode.Success); }
public void Repository_Save() { //Arrange var id = Guid.NewGuid(); EventStorage.Save(Arg.Do <IEnumerable <Event> >(e => e.Any(i => i.Version == 1 && i.AggregateId.Equals(id))), "employees") .Returns(Task.CompletedTask); var employee = new Employee(id, 55, "Alejandro", "Molines", new DateTime(1981, 11, 28), "Developer"); //Act _eventRepository.Save <Employee>(employee).Wait(); //Assert EventStorage.Received(1).Save(Arg.Do <IEnumerable <Event> >(e => e.Any(i => i.Version == 1 && i.AggregateId.Equals(id))), "employees"); }
public Event CreateEvent(User user, Group @group, EventModel model) { var countEventToday = user.CreatedEventId .Select(id => _eventService.GetById(id)) .Count(e => e.CreatedTIme > DateTime.Today.AddDays(-1)); if (countEventToday >= 10) { return(null); } var @event = new Event() { Name = model.Name, CreatedTIme = DateTime.Now, Description = model.Description, EndTime = model.EndTime, PlaceName = model.PlaceName, StartTime = model.StartTime }; _eventStorage.Save(@event); return(@event); }