public void Can_Create_DashBoard()
        {
            UserDashboard userDashboard = new UserDashboard
            {
                Id = "userName",
                Views = new List<DashboardView> {
                    new DashboardView {
                        PageComponents = new List<PageComponent> {
                            new PageComponent {
                                DataviewId = "r1c1",                                            // Row 1 column 1
                                Visualizer = new Visualizer {
                                    Type = "Tabular",
                                    Settings = new Settings {
                                        RecordSchema = new Schema.RecordDescriptorRef {
                                            RecordSchemaId = "RecordSchemas/1"                  // PersonSchema
                                        },
                                        DisplayFields = new List<string> { "Name", "Age" }
                                    }
                                },
                            }
                        }
                    }
                }
            };

            var json = JsonConvert.SerializeObjectAsync(userDashboard).Result;

            var controller = new DashboardController(session);
            Helpers.SetupControllerContext(controller, HttpMethod.Put);

            var response = controller.Put(userDashboard);

            Assert.IsNotNull(response.Headers.Location.AbsoluteUri);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DashboardControllerTests"/> class.
 /// </summary>
 public DashboardControllerTests()
 {
     this.dashboardManager = new Moq.Mock<IDashboardManager>();
     this.dashboardController = new DashboardController(this.dashboardManager.Object);
     CommonHelper.MockHttpRequestContext();
     SessionData.Instance.MasterData = CommonHelper.SetupMasterDataForUIControllers();
 }
        public static void ClassSetup(TestContext testContext)
        {
            _mockDashboardHandler = new Mock<IDashboardHandler>();

            _mockDashboardHandler.Setup(d => d.GetDashboard()).Returns(new AdminDashboard("Admin"));

            _dashboardController = new DashboardController(_mockDashboardHandler.Object);
        }
 public void GetAllMetadataTest()
 {
     DashboardController target = new DashboardController(); // TODO: Initialize to an appropriate value
     string tenantID = string.Empty; // TODO: Initialize to an appropriate value
     List<FileMetadata> expected = null; // TODO: Initialize to an appropriate value
     List<FileMetadata> actual;
     actual = target.GetAllMetadata(tenantID);
     Assert.AreEqual(expected, actual);
     //Assert.Inconclusive("Verify the correctness of this test method.");
 }
        public void DownloadFileTest()
        {
            DashboardController target = new DashboardController(); // TODO: Initialize to an appropriate value
            string tenantId = string.Empty; // TODO: Initialize to an appropriate value
            string fileId = string.Empty; // TODO: Initialize to an appropriate value
            string fileName = string.Empty; // TODO: Initialize to an appropriate value

            fileName = "DataHub.WindowsService.vshost.exe";
            tenantId =  "C428C08B-A863-4814-A250-58F7421F5FF0";
            fileId = "F15BF469-1D9C-49FE-AE18-638D7BAFF053";

            target.DownloadFile(tenantId, fileId, fileName);
            //Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
Exemple #6
0
        public async Task GetServiceWatcherItemsTestAsync()
        {
            // Arrange
            var logger         = LoggerMocker.GetLogger <IDashboardBusinessObject>();
            var businessObject = BusinessObjectMocker.GetDashboardBusinessObject();
            var controller     = new DashboardController(logger, businessObject);

            // Act
            var response = await controller.GetServiceWatcherItemsAsync() as ObjectResult;

            // Assert
            var value = response.Value as IListViewModelResponse <ServiceWatcherItemDto>;

            Assert.False(value.DidError);
        }
Exemple #7
0
        private void loadZonalSummaryForTheMonth()
        {
            grdZonalSummaryForTheMonth.DataSource = null;
            grdZonalSummaryForTheMonth.DataBind();

            DashboardController dashboardController = new DashboardController();

            grdZonalSummaryForTheMonth.DataSource = dashboardController.getZonalSummaryForTheMonth();


            if (grdZonalSummaryForTheMonth.DataSource != null)
            {
                grdZonalSummaryForTheMonth.DataBind();
            }
        }
Exemple #8
0
        public void CallGetAllInventoryItemsUnderSafeteyStock()
        {
            //Arrange
            //var list = new List<InventoryItem>();

            mockInventoryItemsService = new Mock <IInventoryItemsService>();
            mockPhysicalItemsService  = new Mock <IPhysicalItemsService>();
            //mockInventoryItemsService.Setup(m => m.GetAllUnderSafetyStock()).Returns(list);

            sut = new DashboardController(mockInventoryItemsService.Object, mockPhysicalItemsService.Object);

            var listUnderSafetyStock = sut.GetAllInventoryItemsUnderSafetyStock();

            mockInventoryItemsService.Verify(m => m.GetAllUnderSafetyStock());
        }
Exemple #9
0
    private void loadJobSummary(string userBranch)
    {
        grdJobSummary.DataSource = null;
        grdJobSummary.DataBind();

        DashboardController dashboardController = new DashboardController();

        grdJobSummary.DataSource = dashboardController.getJobSummaryOfBranch(userBranch);


        if (grdJobSummary.DataSource != null)
        {
            grdJobSummary.DataBind();
        }
    }
Exemple #10
0
            public void UserWithNoPolls_ReturnsEmptyPollList()
            {
                var existingPolls = new InMemoryDbSet <Poll>(clearDownExistingData: true);

                IContextFactory     mockContextFactory = CreateContextFactory(existingPolls);
                DashboardController controller         = CreateDashboardController(mockContextFactory);

                controller.User = CreateAuthenticatedUser(UserId1);


                List <DashboardPollResponseModel> response = controller.Polls();


                CollectionAssert.AreEquivalent(new List <Poll>(), response);
            }
        public void GetUploadedFilesDetailsTest()
        {
            DashboardController target = new DashboardController(); // TODO: Initialize to an appropriate value
            string tenantId            = string.Empty;              // TODO: Initialize to an appropriate value

            tenantId = "C428C08B-A863-4814-A250-58F7421F5FF0";
            int pageNumber              = 1;    // TODO: Initialize to an appropriate value
            int recordsPerPage          = 1;    // TODO: Initialize to an appropriate value
            List <FileDetails> expected = null; // TODO: Initialize to an appropriate value
            List <FileDetails> actual;

            actual = target.GetUploadedFilesDetails(tenantId, pageNumber, recordsPerPage);
            Assert.AreEqual(expected, actual);
            //Assert.Inconclusive("Verify the correctness of this test method.");
        }
    public void BuildQuickLinks()
    {
        List <QuickLink> lstQuickLinks = DashboardController.GetQuickLinks(GetUsername, GetPortalID);
        StringBuilder    sb            = new StringBuilder();

        sb.Append("<ul>");
        foreach (QuickLink item in lstQuickLinks)
        {
            string image = string.Format("{0}/Modules/Dashboard/Icons/{1}", appPath, item.ImagePath);
            string url   = Utils.BuildURL(item.URL + Extension, appPath, GetPortalSEOName, GetPortalID);
            sb.Append("<li><a href='" + url + "'><img src='" + image + "' width='24' height='24' alt='" + item.DisplayName + "' /><span>" + item.DisplayName + "</span></a></li>");
        }
        sb.Append("</ul>");
        ltrQuicklinks.Text = sb.ToString();
    }
Exemple #13
0
        public async Task GetServiceStatusDetailsTestAsync()
        {
            // Arrange
            var logger         = LoggerMocker.GetLogger <IDashboardBusinessObject>();
            var businessObject = BusinessObjectMocker.GetDashboardBusinessObject();
            var controller     = new DashboardController(logger, businessObject);
            var userName       = "******";

            // Act
            var response = await controller.GetServiceStatusDetailsAsync(userName) as ObjectResult;

            // Assert
            var value = response.Value as IListViewModelResponse <ServiceStatusDetailDto>;

            Assert.False(value.DidError);
        }
        public void CanShowSummaryData()
        {
            DashboardController controller =
                new DashboardController(CreateMockDashboardServiceRepository());

            ViewResult result =
                controller.Index().AssertViewRendered().ForView("");

            Assert.That(result.ViewData, Is.Not.Null);
            Assert.That(result.ViewData.Model as DashboardService.DashboardSummaryDto, Is.Not.Null);

            // I could go on to test the internals of the summary DTO, but I don't really care
            // since here I'm mostly concerned the the controller is getting a response from the
            // application service and giving the summary DTO to the view.  The application service
            // unit tests verify that the service itself is returning valid data.
        }
Exemple #15
0
 public override void UnInstall()
 {
     try
     {
         DashboardControl dashboardControl = DashboardController.GetDashboardControlByPackageId(Package.PackageID);
         if (dashboardControl != null)
         {
             DashboardController.DeleteControl(dashboardControl);
         }
         Log.AddInfo(dashboardControl.DashboardControlKey + " " + Util.DASHBOARD_UnRegistered);
     }
     catch (Exception ex)
     {
         Log.AddFailure(ex);
     }
 }
        public void IndexShouldReturnCorrectViewModelTest()
        {
            var mockUsersService     = new Mock <IUsersService>();
            var mockDonorsService    = new Mock <IDonorsService>();
            var mockHospitalsService = new Mock <IHospitalsService>();
            var viewModel            = new IndexViewModel();

            var controller = new DashboardController(
                mockUsersService.Object,
                mockDonorsService.Object,
                mockHospitalsService.Object);

            var result = controller.Index(viewModel);

            Assert.IsType <ViewResult>(result);
        }
Exemple #17
0
 private void DeleteDashboard()
 {
     try
     {
         DashboardControl dashboardControl = DashboardController.GetDashboardControlByPackageId(Package.PackageID);
         if (dashboardControl != null)
         {
             DashboardController.DeleteControl(dashboardControl);
         }
         Log.AddInfo(dashboardControl.DashboardControlKey + " " + Util.AUTHENTICATION_UnRegistered);
     }
     catch (Exception ex)
     {
         Log.AddFailure(ex);
     }
 }
        private void DashBoardView()
        {
            try
            {
                string PageSEOName = string.Empty;
                if (Request.QueryString["pgnm"] != null)
                {
                    PageSEOName = Request.QueryString["pgnm"].ToString();
                }
                else
                {
                    PageBase        pb       = new PageBase();
                    SageUserControl SageUser = new SageUserControl();
                    PageSEOName = pb.GetPageSEOName(SageUser.PagePath);
                }
                DashboardController  objController = new DashboardController();
                List <DashboardInfo> lstDashboard  = objController.DashBoardView(PageSEOName, GetUsername, GetPortalID);

                GroupItemInfo objbnInfo = new GroupItemInfo();
                //objbnInfo.PortalID = portalID;
                List <GroupItemInfo> objGroupItem = objController.GroupGetAll(GetPortalID, PageSEOName, GetUsername);
                if (objGroupItem.Count > 0)
                {
                    BindGroups(objGroupItem);
                }
                StringBuilder html = new StringBuilder();
                html.Append("<ul  class='" + dragClass + " storePages clearfix' data-groupid='0'>");
                foreach (DashboardInfo objDashboard in lstDashboard)
                {
                    html.Append("<li class='page' data-pageID='" + objDashboard.PageID + "' data-itemid='0'>");
                    objDashboard.IconFile = "<i class='icon-" + objDashboard.PageName.Replace(" ", "-").ToLower() + "'></i>";
                    objDashboard.Url      = objDashboard.Url + Extension;
                    html.Append("<a href=" + objDashboard.Url + "><span class='sfModuleicon'>");
                    html.Append(objDashboard.IconFile);
                    html.Append("</span>");
                    html.Append("<span  class='sfModulename'>" + objDashboard.PageName + "</span>");
                    html.Append("</a>");
                    html.Append("</li>");
                }
                html.Append("</ul>");
                ltradminPageList.Text = html.ToString();
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Exemple #19
0
        public async Task GetServiceWatcherItemsTestAsync()
        {
            // Arrange
            var logger     = LoggerHelper.GetLogger <IDashboardService>();
            var service    = ServiceMocker.GetDashboardService();
            var controller = new DashboardController(logger, service);

            // Act
            var response = await controller.GetServiceWatcherItemsAsync() as ObjectResult;

            var value = response.Value as IListResponse <ServiceWatcherItemDto>;

            controller.Dispose();

            // Assert
            Assert.False(value.DidError);
        }
Exemple #20
0
        private void loadUnknownSummary()
        {
            grdUnknownJobSummary.DataSource = null;
            grdUnknownJobSummary.DataBind();


            DashboardController dashboardController = new DashboardController();

            DataTable dtSummary = dashboardController.getUnknownSummary();

            grdUnknownJobSummary.DataSource = dtSummary;

            if (grdUnknownJobSummary.DataSource != null)
            {
                grdUnknownJobSummary.DataBind();
            }
        }
Exemple #21
0
        private void loadRejectedSummary()
        {
            grdRejectedJobSummary.DataSource = null;
            grdRejectedJobSummary.DataBind();


            DashboardController dashboardController = new DashboardController();

            DataTable dtSummary = dashboardController.getRejectedSummary();

            grdRejectedJobSummary.DataSource = dtSummary;

            if (grdRejectedJobSummary.DataSource != null)
            {
                grdRejectedJobSummary.DataBind();
            }
        }
Exemple #22
0
        private void loadNotScannedYetJobsSummary()
        {
            grdNotScannedYetJobs.DataSource = null;
            grdNotScannedYetJobs.DataBind();


            DashboardController dashboardController = new DashboardController();

            DataTable dtSummary = dashboardController.getNotScannedYetJobsSummary();

            grdNotScannedYetJobs.DataSource = dtSummary;

            if (grdNotScannedYetJobs.DataSource != null)
            {
                grdNotScannedYetJobs.DataBind();
            }
        }
        public void ShouldGetDependentCount()
        {
            Dictionary <DateTime, int> expected = new Dictionary <DateTime, int>()
            {
                { new DateTime(), 3 }
            };
            Mock <IDashboardService> mockService = new Mock <IDashboardService>();

            mockService.Setup(s => s.GetDailyDependentCount(It.IsAny <int>())).Returns(expected);
            DashboardController controller = new DashboardController(
                mockService.Object);

            IActionResult actualResult = controller.GetDependentCount(-480);

            Assert.IsType <JsonResult>(actualResult);
            Assert.True(((JsonResult)actualResult).Value.IsDeepEqual(expected));
        }
        public void ObtenerUAsParametrosNulosTest()
        {
            //Arrange

            //Se crea el mock de la base de datos
            var mockDb        = new Mock <DataIntegradorEntities>();
            var mockFiltrosDb = new Mock <FiltrosEntities>();

            //Se instancia el controlador y se le pasa como parámetro el mock
            DashboardController controller = new DashboardController(mockDb.Object, mockFiltrosDb.Object);

            //Se crean unidades académicas como dummy data
            var UAsDummy = new List <UAsFiltros>
            {
                new UAsFiltros
                {
                    CodigoUA = "00000001",
                    NombreUA = "ECCI"
                },
                new UAsFiltros
                {
                    CodigoUA = "00000002",
                    NombreUA = "Facultad de Ingeniería"
                }
            };

            //Se hace el mock del procedimiento almacenado que utiliza el método del controlador
            var mockedObjectResult = new Mock <IQueryable <UAsFiltros> >();

            mockedObjectResult.Setup(x => x.GetEnumerator()).Returns(UAsDummy.GetEnumerator());
            mockFiltrosDb.Setup(x => x.ObtenerUAsFiltros(null, null, null)).Returns(mockedObjectResult.Object);

            //Act

            //Se hace el llamado al controlador y se obtiene el JSON
            string uasJson = controller.ObtenerUnidadesAcademicas(null, null, null);

            //Se deserializa el JSON
            var uas = JsonConvert.DeserializeObject <List <UAsFiltros> >(uasJson);

            //Assert

            //Se comparan los miembros del formulario dummy con los del formulario retornado por el controlador
            Assert.IsTrue(CompararUAs(UAsDummy, uas));
        }
Exemple #25
0
        protected void OnSaveClick(object sender, EventArgs e)
        {
            try
            {
                string fileName = txtFileName.Text;
                if (!fileName.EndsWith(".xml"))
                {
                    fileName += ".xml";
                }
                DashboardController.Export(fileName);

                UI.Skins.Skin.AddModuleMessage(this, string.Format(Localization.GetString("Success", LocalResourceFile), fileName), ModuleMessage.ModuleMessageType.GreenSuccess);
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Exemple #26
0
        public async Task GetServiceStatusDetailsTestAsync()
        {
            // Arrange
            var logger     = LoggerHelper.GetLogger <IDashboardService>();
            var service    = ServiceMocker.GetDashboardService();
            var controller = new DashboardController(logger, service);
            var userName   = "******";

            // Act
            var response = await controller.GetServiceStatusDetailsAsync(userName) as ObjectResult;

            var value = response.Value as IListResponse <ServiceStatusDetailDto>;

            controller.Dispose();

            // Assert
            Assert.False(value.DidError);
        }
Exemple #27
0
        public override void OnAppLoad()
        {
            // Set the application title
            Title = "Example App";

            // Add navigation mappings
            var welcome = new WelcomeScreenController();
            NavigationMap.Add("WelcomeScreen", welcome);
            NavigationMap.Add("WelcomeScreen/Data/{DataID}", welcome);

            DashboardController dashboardController = new DashboardController();
            NavigationMap.Add("Dashboard", dashboardController);
            NavigationMap.Add("Dashboard/CreateData/{name}", dashboardController);
            NavigationMap.Add("Dashboard/{UserId}", dashboardController);

            // Set default navigation URI
            NavigateOnLoad = "WelcomeScreen";
        }
Exemple #28
0
 public static IMapper GetMapper(this DashboardController account)
 {
     return((new MapperConfiguration(cfg =>
     {
         cfg.CreateMap <AddDatasetViewModel, AddDatasetDTO>();
         cfg.CreateMap <AddDatasetDTO, AddDatasetViewModel>();
         cfg.CreateMap <DatasetViewModel, DatasetDTO>();
         cfg.CreateMap <DatasetDTO, DatasetViewModel>();
         cfg.CreateMap <UpdateDatasetViewModel, UpdateDatasetDTO>();
         cfg.CreateMap <UpdateDatasetDTO, UpdateDatasetViewModel>();
         cfg.CreateMap <DatasetViewModel, UpdateDatasetDTO>();
         cfg.CreateMap <UpdateDatasetDTO, DatasetViewModel>();
         cfg.CreateMap <AddFieldDatasetViewModel, AddFieldDatasetDTO>();
         cfg.CreateMap <AddFieldDatasetDTO, AddFieldDatasetViewModel>();
         cfg.CreateMap <SummaryItemViewModel, SummaryItemDTO>();
         cfg.CreateMap <SummaryItemDTO, SummaryItemViewModel>();
     })).CreateMapper());
 }
Exemple #29
0
    private void loadCompletedJobSummary(string userBranch)
    {
        grdCompletedJobSummary.DataSource = null;
        grdCompletedJobSummary.DataBind();

        DashboardController dashboardController = new DashboardController();
        DataTable           completedJobs       = new DataTable();

        completedJobs = dashboardController.getCompletedJobSummaryOfBranch(userBranch);
        grdCompletedJobSummary.DataSource = completedJobs;

        ds.Tables.Add(completedJobs);

        if (grdCompletedJobSummary.DataSource != null)
        {
            grdCompletedJobSummary.DataBind();
        }
    }
        public void ShouldGetUsersWithNotesCount()
        {
            int expected = 10;
            Mock <IDashboardService> mockService = new Mock <IDashboardService>();

            mockService.Setup(s => s.GetUsersWithNotesCount()).Returns(expected);

            // Initialize controller
            DashboardController controller = new DashboardController(
                mockService.Object
                );

            // Test if controller adds communication properly
            IActionResult actualResult = controller.GetUsersWithNotesCount();

            Assert.IsType <JsonResult>(actualResult);
            Assert.True(((JsonResult)actualResult).Value.IsDeepEqual(expected));
        }
        public override void Install()
        {
            bool bAdd = Null.NullBoolean;

            try
            {
                //Attempt to get the Dashboard
                TempDashboardControl = DashboardController.GetDashboardControlByKey(Key);
                var dashboardControl = new DashboardControl();

                if (TempDashboardControl == null)
                {
                    dashboardControl.IsEnabled = true;
                    bAdd = true;
                }
                else
                {
                    dashboardControl.DashboardControlID = TempDashboardControl.DashboardControlID;
                    dashboardControl.IsEnabled          = TempDashboardControl.IsEnabled;
                }
                dashboardControl.DashboardControlKey            = Key;
                dashboardControl.PackageID                      = Package.PackageID;
                dashboardControl.DashboardControlSrc            = Src;
                dashboardControl.DashboardControlLocalResources = LocalResources;
                dashboardControl.ControllerClass                = ControllerClass;
                dashboardControl.ViewOrder                      = ViewOrder;
                if (bAdd)
                {
                    //Add new Dashboard
                    DashboardController.AddDashboardControl(dashboardControl);
                }
                else
                {
                    //Update Dashboard
                    DashboardController.UpdateDashboardControl(dashboardControl);
                }
                Completed = true;
                Log.AddInfo(dashboardControl.DashboardControlKey + " " + Util.DASHBOARD_Registered);
            }
            catch (Exception ex)
            {
                Log.AddFailure(ex);
            }
        }
        protected async override void OnStart()
        {
            base.OnStart();
            try
            {
                NavigationPage firstPage;
                UserProfile    profile = ServiceLocator.Current.GetInstance <IDatabaseService>().GetUserProfile();
                if (profile != null && profile.IsLoggedIn == true)
                {
                    var thePage = new DashboardController();

                    firstPage = thePage.Detail as NavigationPage;
                    firstPage.SetValue(NavigationPage.HasNavigationBarProperty, false);
                    navigationService.Initialize(firstPage);
                    //firstPage.BarBackgroundColor = Color.FromHex("#000000");
                    MainPage = thePage;
                    var contentHolder = ServiceLocator.Current.GetInstance <IDatabaseService>().GetInput();
                    if (contentHolder != null && contentHolder.Count > 0)
                    {
                        ServiceLocator.Current.GetInstance <TransactionViewModel>().SendContent(contentHolder);
                    }
                    var deviceContent = ServiceLocator.Current.GetInstance <IDatabaseService>().GetContent();
                    if (deviceContent != null && deviceContent.Count > 0)
                    {
                        ServiceLocator.Current.GetInstance <TransactionViewModel>().SendContent(deviceContent);
                    }
                }

                else
                {
                    firstPage = new NavigationPage(new LoginView());
                    // Set Navigation page as default page for Navigation Service:
                    navigationService.Initialize(firstPage);
                    // You have to also set MainPage property for the app:
                    MainPage = firstPage;
                }
                //MainPage = new DashboardController();
                MainPage.SetValue(NavigationPage.BarTextColorProperty, Color.White);
            }
            catch (Exception ex)
            {
                Utils.Utility.ShowDebug(ex);
            }
        }
Exemple #33
0
        public void Index_Get_Initialize_Api_Token()
        {
            // arrange
            var users     = new Mock <IUsersRepository>();
            var path      = new Mock <IPathHelper>();
            var dashboard = new DashboardController(users.Object, path.Object);

            users.Setup(u => u.Users).Returns((new List <User> {
                new User {
                    Id = 100, Email = "*****@*****.**", ApiToken = "111222"
                }
            }).AsQueryable());

            // act
            var result = dashboard.Index("*****@*****.**") as ViewResult;

            // post
            Assert.That(result.ViewData["ApiToken"], Is.EqualTo("111222"));
        }
        public async Task SkipTakeDashboards(int resultCount, int skip, int take)
        {
            var expectedCount = Math.Min(resultCount - skip, take);

            expectedCount = expectedCount < 0 ? 0 : expectedCount;
            int?id;
            var userContext = new UserContext()
            {
                UserId = 1
            };
            var currentUserContext = A.Fake <ICurrentUserContext>();

            A.CallTo(() => currentUserContext.Get()).Returns(userContext);

            var controller = new DashboardController(Service, Mapper, currentUserContext, OwnerTypeService);

            using (var context = await ContextFactory.CreateDbContext())
            {
                context.Dashboards.AddRange(DashboardFactory
                                            .GetFactory(new Dictionary <string, object> {
                    { "OwnerTypeId", 1 }, { "OwnerId", userContext.UserId }
                }).Generate(resultCount));
                context.SaveChanges();

                id = context.Dashboards.Skip(skip).FirstOrDefault()?.Id;
            }



            var response =
                await controller.Search(new SearchQueryDashboard { Skip = skip, Take = take });

            var result = CustomAssert.AssertOkResponseCount(response, expectedCount);

            if (id.HasValue)
            {
                Assert.AreEqual(result.First().Id, id.Value);
            }
            else
            {
                Assert.AreEqual(result.Count, 0);
            }
        }
Exemple #35
0
        private DashboardController SetupControllerForAuthenticationConnectTests()
        {
            var userService = new Mock <IUserService>();

            userService.Setup(us => us.UpdateRoleAsync(It.IsAny <int>(), 2));

            var controller = new DashboardController(userService.Object)
            {
                ControllerContext = new ControllerContext()
                {
                    HttpContext = new DefaultHttpContext()
                    {
                        User = new ClaimsPrincipal()
                    }
                },
            };

            return(controller);
        }
Exemple #36
0
        public async Task RunTest(int id)
        {
            var startTask = _hubContext.Clients.All.SendAsync("TestStarted", id);

            using (var db = new LiteDatabase(_connectionStrings.Value.EasyDashDatabase))
            {
                var collection    = db.GetCollection <UrlConfiguration>("UrlConfigurations");
                var configuration = collection.FindById(id);

                var runner     = new UrlRunner();
                var testResult = await runner.Test(configuration);

                configuration.UrlTestStatuses.Insert(0, testResult);

                collection.Update(configuration);
                await startTask;
                await _hubContext.Clients.All.SendAsync("TestEnded", DashboardController.TransformToDashboardResult(configuration));
            }
        }
 public void SearchFileTest()
 {
     DashboardController target = new DashboardController(); // TODO: Initialize to an appropriate value
     string searchText = string.Empty; // TODO: Initialize to an appropriate value
     string tenantId = string.Empty; // TODO: Initialize to an appropriate value
     List<string> expected = null; // TODO: Initialize to an appropriate value
     List<string> actual;
     actual = target.SearchFile(searchText, tenantId);
     Assert.AreEqual(expected, actual);
        // Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void MainViewNotNull()
 {
     DashboardController dbc = new DashboardController();
     Assert.NotNull(dbc.Main());
 }
Exemple #39
0
 public void ValidUserTest()
 {
     var dc = new DashboardController();
     Assert.IsTrue(dc.userExists("blu", "blu"));
 }
 public void LoginViewNotNull()
 {
     DashboardController dbc = new DashboardController();
     Assert.NotNull(dbc.Index());
 }
Exemple #41
0
 public void InvalidUserTest()
 {
     var dc = new DashboardController();
     Assert.IsFalse(dc.userExists("jahgsjdhgkjdsghds", "bljbdsjdhsgkjhdsgjksdagjadsu"));
 }
 public void IndexTest()
 {
     DashboardController target = new DashboardController(); // TODO: Initialize to an appropriate value
     string tenantId = string.Empty; // TODO: Initialize to an appropriate value
     ActionResult expected = null; // TODO: Initialize to an appropriate value
     ActionResult actual;
     actual = target.Index(tenantId);
     Assert.AreEqual(expected, actual);
     //Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void GetFilesTest()
 {
     DashboardController target = new DashboardController(); // TODO: Initialize to an appropriate value
     string tenantId = string.Empty; // TODO: Initialize to an appropriate value
     tenantId = "C428C08B-A863-4814-A250-58F7421F5FF0";
     int pageNumber = 1; // TODO: Initialize to an appropriate value
     ActionResult expected = null; // TODO: Initialize to an appropriate value
     ActionResult actual;
     actual = target.GetFiles(tenantId, pageNumber);
     Assert.AreEqual(expected, actual);
     //Assert.Inconclusive("Verify the correctness of this test method.");
 }
 public void GetUploadedFilesDetailsTest()
 {
     DashboardController target = new DashboardController(); // TODO: Initialize to an appropriate value
     string tenantId = string.Empty; // TODO: Initialize to an appropriate value
     tenantId = "C428C08B-A863-4814-A250-58F7421F5FF0";
     int pageNumber = 1; // TODO: Initialize to an appropriate value
     int recordsPerPage = 1; // TODO: Initialize to an appropriate value
     List<FileDetails> expected = null; // TODO: Initialize to an appropriate value
     List<FileDetails> actual;
     actual = target.GetUploadedFilesDetails(tenantId, pageNumber, recordsPerPage);
     Assert.AreEqual(expected, actual);
     //Assert.Inconclusive("Verify the correctness of this test method.");
 }