Ejemplo n.º 1
0
        public void TestFinishTask()
        {
            Guid memberGuid = Guid.NewGuid();

            System.Data.Objects.IObjectSet<GetItDone.Task> tasks = new InMemoryObjectSet<GetItDone.Task>(new GetItDone.Task[] { new GetItDone.Task() { Id = 1, Title = "Blah", ProjectId = null, OwnerId = memberGuid, Notes = "", Project = null } });
            TestTaskModelContainer container = new TestTaskModelContainer(tasks);

            Assert.Equal(1, container.Tasks.Count());

            //container.Tasks.AddObject(new GetItDone.Task { Id = 1, ProjectId = null, Project = null, Title = "Finishing task", OwnerId = memberGuid });

            GetItDone.ITaskService taskService = new GetItDone.TaskService(container, memberGuid);

            GetItDone.GetItDone.TaskController tc = new GetItDone.GetItDone.TaskController(taskService);

            ViewResult ar = tc.Finish(1) as ViewResult;

            Assert.NotNull(ar);

            TaskModel tm = ar.Model as TaskModel;

            Assert.NotNull(tm);
            Assert.Equal("Blah", tm.Title);
            Assert.Null(tm.ProjectName);
        }
Ejemplo n.º 2
0
 public EmployeeControllerTestBase()
 {
     _employeeData = EmployeeObjectMother.CreateEmployees()
                     .ToList();
     _repository           = new InMemoryObjectSet <Employee>(_employeeData);
     _unitOfWork           = new InMemoryUnitOfWork();
     _unitOfWork.Employees = _repository;
     _controller           = new EmployeeController(_unitOfWork);
 }
Ejemplo n.º 3
0
        public IObjectSet <T> ToObjectSet(System.Data.IDataReader reader)
        {
            var rep = new InMemoryObjectSet <T>();
            var res = ToList(reader);

            foreach (var item in res)
            {
                rep.AddObject(item);
            }

            return(rep);
        }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            var employees = GenerateEmployeeList();

            InMemoryObjectSet<Employee> employeeObjectSet = new InMemoryObjectSet<Employee>(employees);
            InMemoryUnitOfWork inMemoryUnitOfWork = new InMemoryUnitOfWork();
            inMemoryUnitOfWork.Employees = employeeObjectSet;

            FindEmployee(inMemoryUnitOfWork);
            AddEmployee(inMemoryUnitOfWork);
            RemoveEmployee(inMemoryUnitOfWork);
            UpdateEmployee(inMemoryUnitOfWork);

            Console.ReadLine();
        }
Ejemplo n.º 5
0
        public static void Main(string[] args)
        {
            var employees = GenerateEmployeeList();

            InMemoryObjectSet <Employee> employeeObjectSet  = new InMemoryObjectSet <Employee>(employees);
            InMemoryUnitOfWork           inMemoryUnitOfWork = new InMemoryUnitOfWork();

            inMemoryUnitOfWork.Employees = employeeObjectSet;

            FindEmployee(inMemoryUnitOfWork);
            AddEmployee(inMemoryUnitOfWork);
            RemoveEmployee(inMemoryUnitOfWork);
            UpdateEmployee(inMemoryUnitOfWork);

            Console.ReadLine();
        }