コード例 #1
0
ファイル: ProjectTasks.cs プロジェクト: jsmale/TimeTracker
 public void CreateProject(CreateProjectRequest createProjectRequest)
 {
     var project = new Project
                   	{
                   		Id = Guid.NewGuid(),
                   		Name = createProjectRequest.Name,
                   		ProjectCode = createProjectRequest.ProjectCode
                   	};
     repository.Insert(project);
 }
コード例 #2
0
        public ActionResult Create(CreateProjectRequest createProjectRequest)
        {
            if (!ModelState.IsValid)
             {
             	return View();
             }

                projectTasks.CreateProject(createProjectRequest);

                return RedirectToAction("Index");
        }
コード例 #3
0
        public void Create_should_insert_project_into_repository()
        {
            var project = new CreateProjectRequest { Name = "Name", ProjectCode = "Code" };

            CreateSUT().CreateProject(project);

            repository.AssertWasCalled(x => x.Insert(Arg<Project>.Matches(y =>
                y.Id != Guid.Empty
                && y.Name == project.Name
                && y.ProjectCode == project.ProjectCode)));
        }