static Storage() { StorageTexts = new Dictionary <int, string>(); StorageTasks = new List <InfoTask>(); StorageBinaryFiles = new Dictionary <DateTime, byte[]>(); DataTaskStorage = new TaskStorage(); }
public void FavoriteUpdater_UserCreatesNewFavorite_NewFavoriteIsCreated() { var context = new AlvTimeDbContextBuilder() .WithTasks() .WithProjects() .WithCustomers() .CreateDbContext(); var previousNumberOfFavorites = context.TaskFavorites .Where(tf => tf.UserId == 1) .ToList().Count(); var storage = new TaskStorage(context); var updater = new FavoriteUpdater(storage); updater.UpdateFavoriteTasks(new UpdateTasksDto { Id = 2, Favorite = true }, 1); var userFavorites = context.TaskFavorites .Where(tf => tf.UserId == 1) .ToList(); Assert.Equal(previousNumberOfFavorites + 1, userFavorites.Count()); }
public void FavoriteUpdater_UserCreatesNewFavoriteWithCompensationRate_NewFavoriteIsCreatedCompensationRateIsUnchanged() { var context = new AlvTimeDbContextBuilder() .WithTasks() .WithProjects() .WithCustomers() .CreateDbContext(); var previousNumberOfFavorites = context.TaskFavorites .Where(tf => tf.UserId == 1) .ToList().Count(); var storage = new TaskStorage(context); var updater = new FavoriteUpdater(storage); var previousCompensationRate = context.Task.FirstOrDefault(x => x.Id == 2).CompensationRate; updater.UpdateFavoriteTasks(new UpdateTasksDto { Id = 2, Favorite = true, }, 1); var task = context.Task.FirstOrDefault(x => x.Id == 2); Assert.Equal(previousCompensationRate, task.CompensationRate); }
public void GetTasks_NoCriterias_AllTasks() { var context = new AlvTimeDbContextBuilder() .WithTasks() .WithProjects() .WithCustomers() .CreateDbContext(); var storage = new TaskStorage(context); var tasks = storage.GetUsersTasks(new TaskQuerySearch(), 1); Assert.Equal(context.Task.Count(), tasks.Count()); }
public void GetTasks_ProjectIsGiven_AllTasksWithSpecifiedProject() { var context = new AlvTimeDbContextBuilder() .WithTasks() .WithProjects() .WithCustomers() .CreateDbContext(); var storage = new TaskStorage(context); var tasks = storage.GetUsersTasks(new TaskQuerySearch { Project = 1 }, 1); Assert.True(1 == tasks.Single().Project.Id); }
public AutomationManagement() { this.storage = new TaskStorage(); this.factory = new BrowserFactory(this); this.webBrowser = new WebBrowserEx(); this.webBrowser.NewWindow3 += webBrowser_NewWindow3; this.webBrowser.DocumentCompleted += webBrowser_DocumentCompleted; timer = new WebBrowserTimer(this.webBrowser); timer.Tick += timer_Tick; timer.Interval = 10; timer.Enabled = false; this.backgroundWorker = new BackgroundWorker(); this.backgroundWorker.WorkerSupportsCancellation = true; this.backgroundWorker.DoWork += backgroundWorker_DoWork; this.backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted; }
public void TaskCreator_UpdateBothLockedAndName_LockedAndNameIsUpdated() { var context = new AlvTimeDbContextBuilder() .WithTasks() .WithProjects() .WithCustomers() .CreateDbContext(); var storage = new TaskStorage(context); var creator = new TaskCreator(storage); creator.UpdateTask(new UpdateTasksDto { Id = 1, Locked = true, Name = "MyExampleTask" }); var task = context.Task.FirstOrDefault(x => x.Id == 1); Assert.Equal("MyExampleTask", task.Name); Assert.True(task.Locked == true); }
public void TaskCreator_CreateNewTaskAlreadyExists_NoNewTaskIsCreated() { var context = new AlvTimeDbContextBuilder() .WithTasks() .WithProjects() .WithCustomers() .CreateDbContext(); var storage = new TaskStorage(context); var creator = new TaskCreator(storage); var previousNumberOfTasks = context.Task.Count(); creator.CreateTask(new CreateTaskDto { Name = "ExampleTask", Description = "", Locked = false, Project = 1 }); Assert.Equal(previousNumberOfTasks, context.Task.Count()); }