Пример #1
0
        public void CreateNewProjectWithPhotograph()
        {
            var dbContextScopeFactory = new DbContextScopeFactory();
            var ambientDbContextLocator = new AmbientDbContextLocator();
            var projectRepository = new ProjectRepository(ambientDbContextLocator);

            var photographs = new List<Photograph>();
            photographs.Add(new Photograph {

                Location="home",
                Title="photo title"

            });

            photographs.Add(new Photograph
            {

                Location = "home2",
                Title = "photo title2"

            });

            var projectService = new ProjectServices(dbContextScopeFactory, projectRepository);

            Project project = new Project
            {
                Description = "test",
                Title = "Test title",
                Photographs = photographs
            };

            projectService.CreateProject(project);
        }
Пример #2
0
 public void Setup()
 {
     _dbContextScopeFactory = Substitute.For<IDbContextScopeFactory>();
     _ambientDbContextLocator = Substitute.For<IAmbientDbContextLocator>();
     _projectRepository = Substitute.For<IProjectRepository>();
     _dbContext = Substitute.For<IDbContextScope>();
     _dbContextScopeFactory.Create().Returns(_dbContext);
     _projectService = new ProjectServices(_dbContextScopeFactory, _projectRepository);
 }
Пример #3
0
        public void CreateAProjectWitNullContextScopeAndNullRepository()
        {
            //Act
            _projectService = new ProjectServices(null, (IProjectRepository)null);

            //Assert
        }
Пример #4
0
        public void CreateAProjectWithNullRepository()
        {
            //Act
            _projectService = new ProjectServices(_dbContextScopeFactory, (IProjectRepository)null);

            //Assert
        }
Пример #5
0
        public void CreateAProjectWithNullContextScope()
        {
            //Act
            _projectService = new ProjectServices(null, _projectRepository);

            //Assert
        }