public async void AddAsyncShouldAddDashboard()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbAddDashboardsAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var dashboardRepository = new DashboardRepository(overwatchContext);
                await DashboardRepositoryFillerAsync(dashboardRepository, _dashboards);

                var result = await dashboardRepository.GetAllAsync();

                Assert.Equal(result.Count(), _dashboards.Count());
            }
        }
Esempio n. 2
0
        public async void AddAsyncShouldAddWidget()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbAddWidgetsAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var widgetRepository = new WidgetRepository(overwatchContext);
                await WidgetRepositoryFillerAsync(widgetRepository, _widgets);

                var result = await widgetRepository.GetAllAsync();

                Assert.Equal(result.Count(), _widgets.Count());
            }
        }
        public async void GetDashboardByProjectIdShouldReturnCorrectDashboard()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbGetDashboardByProjectIdAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var dashboardRepository = new DashboardRepository(overwatchContext);
                await DashboardRepositoryFillerAsync(dashboardRepository, _dashboards);

                var result = await dashboardRepository.GetDashboardByProjectId(_dashboards.First().ProjectId);

                Assert.Equal(_dashboards, result);
            }
        }
Esempio n. 4
0
        public async void DeleteByIdAsyncShouldDeleteCorrectWidget()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbDeleteByIdAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var    widgetRepository = new WidgetRepository(overwatchContext);
                Widget widgetToDelete   = _widgets.First();
                await widgetRepository.AddAsync(widgetToDelete);

                var result = await widgetRepository.DeleteByIdAsync(widgetToDelete.Id);

                Assert.Equal(1, result);
            }
        }
Esempio n. 5
0
        public async void GetByIdAsyncShouldReturnCorrectWidget()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbGetWidgetByIdAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var    widgetRepository = new WidgetRepository(overwatchContext);
                Widget widgetToFind     = _widgets.First();
                await widgetRepository.AddAsync(widgetToFind);

                var result = await widgetRepository.GetByIdAsync(widgetToFind.Id);

                Assert.Equal(widgetToFind, result);
            }
        }
Esempio n. 6
0
        public async void DeleteByIdAsyncShouldDeleteCorrectProject()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbDeleteProjectByIdAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var     projectRepository = new ProjectRepository(overwatchContext);
                Project projectToDelete   = _projects.First();
                await projectRepository.AddAsync(projectToDelete);

                var result = await projectRepository.DeleteByIdAsync(projectToDelete.Id);

                Assert.Equal(1, result);
            }
        }
Esempio n. 7
0
        public async void GetByIdAsyncShouldReturnCorrectProject()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbGetProjectByIdAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var     projectRepository = new ProjectRepository(overwatchContext);
                Project projectToFind     = _projects.First();
                await projectRepository.AddAsync(projectToFind);

                var result = await projectRepository.GetByIdAsync(projectToFind.Id);

                Assert.Equal(projectToFind, result);
            }
        }
Esempio n. 8
0
        public async void GetAllAsyncShouldReturnAllProjects()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbGetAllProjectsAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var projectRepository = new ProjectRepository(overwatchContext);
                await ProjectRepositoryFillerAsync(projectRepository, _projects);

                var result = await projectRepository.GetAllAsync();

                Assert.Equal(result.Count(), _projects.Count());
                Assert.Equal(result, _projects);
            }
        }
        public async void DeleteByIdAsyncShouldDeleteCorrectDashboard()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbDeleteDashboardByIdAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var       dashboardRepository = new DashboardRepository(overwatchContext);
                Dashboard dashboardToDelete   = _dashboards.First();
                await dashboardRepository.AddAsync(dashboardToDelete);

                var result = await dashboardRepository.DeleteByIdAsync(dashboardToDelete.Id);

                Assert.Equal(1, result);
            }
        }
        public async void GetByIdAsyncShouldReturnCorrectDashboard()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbGetDashboardByIdAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var       dashboardRepository = new DashboardRepository(overwatchContext);
                Dashboard dashboardToFind     = _dashboards.First();
                await dashboardRepository.AddAsync(dashboardToFind);

                var result = await dashboardRepository.GetByIdAsync(dashboardToFind.Id);

                Assert.Equal(dashboardToFind, result);
            }
        }
Esempio n. 11
0
        public async void PutAsyncShouldEditCorrectWidget()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbPutWidgetAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var widgetRepository = new WidgetRepository(overwatchContext);
                await WidgetRepositoryFillerAsync(widgetRepository, _widgets);

                Widget widgetToEdit = _widgets.First();
                widgetToEdit.Color = "Green";
                var result = await widgetRepository.PutAsync(widgetToEdit.Id, widgetToEdit);

                Assert.Equal(1, result);
                var returnedWidget = widgetRepository.GetByIdAsync(widgetToEdit.Id).Result;
                Assert.Equal(returnedWidget, widgetToEdit);
            }
        }
Esempio n. 12
0
        public async void PutAsyncShouldEditCorrectProject()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbPutProjectAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var projectRepository = new ProjectRepository(overwatchContext);
                await ProjectRepositoryFillerAsync(projectRepository, _projects);

                Project projectToEdit = _projects.First();
                projectToEdit.Url = "Green";
                var result = await projectRepository.PutAsync(projectToEdit.Id, projectToEdit);

                Assert.Equal(1, result);
                var returnedproject = projectRepository.GetByIdAsync(projectToEdit.Id).Result;
                Assert.Equal(returnedproject, projectToEdit);
            }
        }
        public async void PutAsyncShouldEditCorrectDashboard()
        {
            var options = OverwatchOptionBuilder.CreateBuilderWithName("OverwatchDbPutDashboardAsync");

            using (var overwatchContext = new OverwatchContext(options))
            {
                var dashboardRepository = new DashboardRepository(overwatchContext);
                await DashboardRepositoryFillerAsync(dashboardRepository, _dashboards);

                Dashboard dashboardToEdit = _dashboards.First();
                dashboardToEdit.Description = "Green";
                var result = await dashboardRepository.PutAsync(dashboardToEdit.Id, dashboardToEdit);

                Assert.Equal(1, result);
                var returneddashboard = dashboardRepository.GetByIdAsync(dashboardToEdit.Id).Result;
                Assert.Equal(returneddashboard, dashboardToEdit);
            }
        }
 public WidgetRepository(OverwatchContext context)
 {
     _context = context;
 }
Esempio n. 15
0
 public DashboardRepository(OverwatchContext context)
 {
     _context = context;
 }
Esempio n. 16
0
 public ProjectRepository(OverwatchContext context)
 {
     _context = context;
 }