public void WithAllDependenciesNotNUllShouldFail()
            {
                ITaskRepository       taskRepo    = Substitute.For <ITaskRepository>();
                ISystemInfoRepository sysInfoRepo = Substitute.For <ISystemInfoRepository>();

                LoadLandingPageData userCase = new LoadLandingPageData(taskRepo, sysInfoRepo);

                Assert.That(() => new LoadLandingPageData(taskRepo, sysInfoRepo), Throws.Nothing);
            }
Ejemplo n.º 2
0
            public void WithOneUserAndNoTasks()
            {
                ITaskRepository taskRepo = Substitute.For <ITaskRepository>();

                taskRepo.GetTotalCount().Returns(0);
                taskRepo.GetTasksFor(Arg.Any <User>())
                .Returns(new HashSet <Core.Model.Task>());

                ISystemInfoRepository sysInfoRepo = Substitute.For <ISystemInfoRepository>();

                sysInfoRepo.GetActiveUsers().Returns(1);

                LoadLandingPageData useCase = new LoadLandingPageData(taskRepo, sysInfoRepo);
                User theUser = new User {
                    Username = "******"
                };

                LandingPageData data = useCase.GetData(theUser);

                Assert.That(data.ActiveUsers, Is.EqualTo(1));
                Assert.That(data.TotalTasks, Is.EqualTo(0));
                Assert.That(data.UserTasks, Has.Count.EqualTo(0));
            }
Ejemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            using (TodoListContext context = new TodoListContext())
            {
                ITaskRepository       taskRepo = new EFTaskRepository(context);
                ISystemInfoRepository sysRepo  = new EFSystemInfoRepository();

                LoadLandingPageData useCase = new LoadLandingPageData(taskRepo, sysRepo);
                User theuser = new User {
                    UserId = 1
                };

                LandingPageData data = useCase.GetData(theuser);

                ActiveUser = data.ActiveUsers;
                TotalTask  = data.TotalTasks;


                //var connectionFromConfiguration = WebConfigurationManager.ConnectionStrings["ToDoListStr"];
                //using (SqlConnection dbConnection = new SqlConnection(connectionFromConfiguration.ConnectionString))
                //{
                //    try
                //    {
                //        dbConnection.Open();
                //        Message = "Connection Succesfull";

                //    }
                //    catch (SqlException ex)
                //    {
                //        Message = "connection failed";
                //    }


                //}
            }
        }