示例#1
0
        public void InsertProject()
        {
            _container = EntityContainer.InsertableContainer <Domain.Models.Project> .ContainerConfig();

            try
            {
                using (var scope = _container.BeginLifetimeScope())
                {
                    var insertableProject = _container.Resolve <EntityService.Interfaces.IInsertable <Domain.Models.Project> >();

                    var Project = new Domain.Models.Project()
                    {
                        ImageFileAddress = "insert test",
                        Name             = "test test",
                        ShortDescription = "short test",
                        Status           = true,
                        TextFileAddress  = "test text",
                        State            = "0",
                        TimeToFinish     = 120
                    };

                    insertableProject.Insert(Project);
                }
            }
            catch (Exception error)
            {
                Assert.Fail(error.Message);
            }
        }
示例#2
0
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            _gallery = context.GalleryTable.FirstOrDefault();
            _project = context.ProjectTable.FirstOrDefault();
            _product = context.ProductTable.FirstOrDefault();

            if (_project == null)
            {
                var Project = new Domain.Models.Project()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    State            = "0",
                    Status           = true,
                    TextFileAddress  = "test",
                    TimeToFinish     = 150
                };
                context.ProjectTable.Add(Project);
                context.SaveChanges();
                _project = Project;
            }

            if (_product == null)
            {
                var Product = new Domain.Models.Product()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    Status           = true,
                    TextFileAddress  = "test"
                };
                context.ProductTable.Add(Product);
                context.SaveChanges();
                _product = Product;
            }

            if (_gallery == null)
            {
                var Gallery = new Domain.Models.Gallery()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Description      = "some test",
                    Project          = _project,
                    Product          = _product
                };

                context.GalleryTable.Add(Gallery);
                context.SaveChanges();
                _gallery = Gallery;
            }
        }
示例#3
0
        public bool AddProject(ProjectDTO project)
        {
            Domain.Models.Project newProject = new Domain.Models.Project()
            {
                Name = project.Name, Description = project.Description, Administrator = project.Administrator, Moderators = new List <int>(), Users = new List <int>()
            };

            _projectRepository.AddProject(newProject);
            return(_projectRepository.Save());
        }
示例#4
0
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            _platform = context.PlatformTable.FirstOrDefault();
            _project  = context.ProjectTable.FirstOrDefault();
            _product  = context.ProductTable.FirstOrDefault();

            if (_project == null)
            {
                var Project = new Domain.Models.Project()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    State            = "0",
                    Status           = true,
                    TextFileAddress  = "test",
                    TimeToFinish     = 150
                };
                context.ProjectTable.Add(Project);
                context.SaveChanges();
                _project = Project;
            }

            if (_product == null)
            {
                var Product = new Domain.Models.Product()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    Status           = true,
                    TextFileAddress  = "test"
                };
                context.ProductTable.Add(Product);
                context.SaveChanges();
                _product = Product;
            }

            if (_platform == null)
            {
                var Platform = new Domain.Models.Platform()
                {
                    ID              = DateTime.Now.Ticks.ToString(),
                    Name            = "test",
                    IconFileAddress = "test Icon"
                };

                context.PlatformTable.Add(Platform);
                _platform = Platform;
            }
        }
示例#5
0
        public ProjectDTO GetProject(int?projectId)
        {
            Domain.Models.Project project = _projectRepository.GetProject(projectId.Value);

            ProjectDTO projectDTO = new ProjectDTO()
            {
                Id = project.Id, Name = project.Name, Description = project.Description, Boards = MapBoardsToDTO(project.Boards), Administrator = project.Administrator, Moderators = project.Moderators, Users = project.Users
            };

            return(projectDTO);
        }
示例#6
0
        public void RemoveProject()
        {
            _container = EntityContainer.RemoveableContainer.ContainerConfig <EntityService.Entities.Project.ModifiableProject>(_project.ID);

            try
            {
                using (var scope = _container.BeginLifetimeScope())
                {
                    var removeableProject = _container.Resolve <EntityService.Interfaces.IRemoveable>();

                    removeableProject.Remove();
                }
            }
            catch (Exception error)
            {
                Assert.Fail(error.Message);
            }
            finally
            {
                _project = new Domain.DataAccess.MahourContext().ProjectTable.FirstOrDefault();
            }
        }
示例#7
0
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            if (_project == null)
            {
                var Project = new Domain.Models.Project()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    Status           = true,
                    TextFileAddress  = "test",
                    State            = "0",
                    TimeToFinish     = 120
                };
                context.ProjectTable.Add(Project);
                context.SaveChanges();
                _project = Project;
            }
        }
        public void Setup()
        {
            var context = new Domain.DataAccess.MahourContext();

            _color   = context.ColorTable.FirstOrDefault();
            _project = context.ProjectTable.FirstOrDefault();

            if (_color == null)
            {
                var Color = new Domain.Models.Color()
                {
                    ID   = DateTime.Now.Ticks.ToString(),
                    Code = "#123456"
                };
                context.ColorTable.Add(Color);
                context.SaveChanges();
                _color = Color;
            }

            if (_project == null)
            {
                var Project = new Domain.Models.Project()
                {
                    ID = DateTime.Now.Ticks.ToString(),
                    ImageFileAddress = "test",
                    Name             = "test",
                    ShortDescription = "test",
                    State            = "0",
                    Status           = true,
                    TextFileAddress  = "test",
                    TimeToFinish     = 150
                };
                context.ProjectTable.Add(Project);
                context.SaveChanges();
                _project = Project;
            }
        }