Пример #1
0
        public async Task <BugItem> UpdateStatus(Guid bugItemId, BugStatus status, string userId = null)
        {
            var bugItemToUpdate = (await BugReader.GetBugItems(BugStatus.open)).FirstOrDefault(x => x.Id == bugItemId);

            if (bugItemToUpdate == null)
            {
                bugItemToUpdate = (await BugReader.GetBugItems(BugStatus.closed)).FirstOrDefault(x => x.Id == bugItemId);
                if (bugItemToUpdate == null)
                {
                    throw new Exception($"No bug with given bug id {bugItemId} was found");
                }
            }
            bugItemToUpdate.Status = status;
            HttpResponseMessage bugItems;

            if (!string.IsNullOrEmpty(userId))
            {
                bugItems = await _httpClient.PutAsync($"{_httpClient.BaseAddress}bugs/id/{bugItemToUpdate.Id}/status/{status.ToString()}/user-id/{userId}", null);

                return(JsonConvert.DeserializeObject <BugItem>(await bugItems.Content.ReadAsStringAsync()));
            }
            bugItems = await _httpClient.PutAsync($"{_httpClient.BaseAddress}bugs/id/{bugItemToUpdate.Id}/status/{status.ToString()}", null);

            return(JsonConvert.DeserializeObject <BugItem>(await bugItems.Content.ReadAsStringAsync()));
        }
Пример #2
0
 public void UpdateStatus(string id, BugStatus status)
 {
     Bug bug = this.GetById(id);
     bug.Status = status;
     this.bugs.Update(bug);
     this.bugs.SaveChanges();
 }
Пример #3
0
        public void Deserialize(GenericReader reader)
        {
            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                _Submitter       = reader.ReadString();
                _CreationTime    = reader.ReadDateTime();
                _LastUpdatedTime = reader.ReadDateTime();
                _AssignedTo      = (Server.BugTracker.AssignedTo)reader.ReadInt();
                _Description     = reader.ReadString();
                _Title           = reader.ReadString();

                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    CommentEntry e = new CommentEntry();
                    e.Deserialize(reader);

                    if (_Comments == null)
                    {
                        _Comments = new List <CommentEntry>();
                    }

                    _Comments.Add(e);
                }

                _Status = (BugStatus)reader.ReadInt();
                break;
            }
            }
        }
Пример #4
0
 public IQueryable<Bug> GetByStatus(BugStatus status)
 {
     return this
         .All()
         .ToList()
         .Where(bug => bug.Status == status)
         .AsQueryable();
 }
Пример #5
0
 public FakeBug(string id)
 {
     this.Id        = id;
     this.steps     = new List <string>();
     this.bugStatus = BugStatus.Active;
     this.comments  = new Dictionary <IMember, IList <string> >();
     this.History   = new List <string>();
 }
Пример #6
0
 public Bug(string id, string title, PriorityType priority, SeverityType severity, IList <string> steps, string description)
     : base(id, title, description)
 {
     this.priorityType = priority;
     this.severityType = severity;
     this.bugStatus    = BugStatus.Active;
     this.steps        = steps;
 }
        /// <summary>
        /// Process status.
        /// </summary>
        private static BugStatus ProcessStatus(Record record)
        {
            BugStatus status = BugStatus.None;
            string    str    = record[StatusCol];
            bool      found  = str != null?s_statusMappings.TryGetValue(str, out status) : false;

            return(found ? status : BugStatus.None);
        }
Пример #8
0
        public Bug(string title, BugStatus status, BugPriority priority, DateTime dueDate)
        {
            Title    = title;
            Status   = status;
            Priority = priority;
            DueDate  = dueDate;

            DateCreated = DateTime.UtcNow;
        }
Пример #9
0
 public void Activate(string comments)
 {
     Status = BugStatus.Working;
     DateTime now = DateTime.Now;
     _history.Add(new Tuple<DateTime, List<Tuple<string, string>>, string>(
                      now, new List<Tuple<string, string>>{
                          new Tuple<string, string>("Status", "Active")
                      }, comments));
 }
Пример #10
0
 public void Approve()
 {
     Status = BugStatus.Backlog;
     var now = DateTime.Now;
     _history.Add(new Tuple<DateTime, List<Tuple<string, string>>, string>(
         now, new List<Tuple<string, string>>{
             new Tuple<string, string>("Status", "Backlog")},
             string.Empty ));
 }
Пример #11
0
        public void ValidateBugStatus_WithValidData()
        {
            //Arrange
            Validator validator      = new Validator();
            string    statusAsString = "Active";
            BugStatus expected       = BugStatus.Active;
            //Act
            BugStatus sut = validator.ValidateBugStatus(statusAsString);

            //Assert
            Assert.AreEqual(expected, sut);
        }
        public async Task <BugStatus> GetStatus()
        {
            var statusHistory = await this.StateManager.TryGetStateAsync <StatusHistory>("statusHistory");

            var assignee = await this.StateManager.TryGetStateAsync <string>("assignee");

            var status = new BugStatus(this.machine.State);

            status.History  = statusHistory.HasValue ? statusHistory.Value : new StatusHistory(machine.State);
            status.Assignee = assignee.HasValue ? assignee.Value : string.Empty;

            return(status);
        }
Пример #13
0
        public BugEntry(string submitter, string title, string description)
        {
            _Submitter   = submitter;
            _Title       = title;
            _Description = description;

            _CreationTime    = DateTime.Now;
            _LastUpdatedTime = _CreationTime;

            _AssignedTo = AssignedTo.Jeff;
            _Status     = BugStatus.New;

            _Comments = new List <CommentEntry>();
        }
Пример #14
0
        public IHttpActionResult ChangeStatus(int id, BugStatus newStatus)
        {
            var bugFromDb = this.BugLoggerData.Bugs.Find(id);

            if (bugFromDb == null)
            {
                return(this.BadRequest(string.Format("Bug with id={0} does not exists.", id)));
            }

            bugFromDb.Status = newStatus;
            this.BugLoggerData.SaveChanges();

            return(this.Ok(bugFromDb));
        }
        public void AutoPopulateHistory()
        {
            //Arrange
            string        title            = "BugTitle";
            string        description      = "valid description";
            List <string> stepsToReproduce = new List <string> {
                "step1", "step2", "step3"
            };
            Priority  priority = Priority.High;
            Severity  severity = Severity.Critical;
            BugStatus status   = BugStatus.Active;
            //Act
            IBug sut = new Bug(title, description, stepsToReproduce, priority, severity, status);

            //Assert
            Assert.AreEqual(sut.History.Count, 5);
        }
        public void CreateBug()
        {
            //Arrange
            IFactory      factory          = new Factory();
            string        title            = "TestBug";
            string        description      = "valid description";
            List <string> stepsToReproduce = new List <string> {
                "step1", "step2", "step3"
            };
            Priority  priority = Priority.High;
            Severity  severity = Severity.Critical;
            BugStatus status   = BugStatus.Active;
            //Act
            var sut = factory.CreateBug(title, description, stepsToReproduce, priority, severity, status);

            //Assert
            Assert.IsInstanceOfType(sut, typeof(Bug));
        }
        public void ContainWorkItems()
        {
            //Arrange
            string        name             = "TestBoard";
            var           sut              = new Board(name);
            string        title            = "BugTitle";
            string        description      = "valid description";
            List <string> stepsToReproduce = new List <string> {
                "step1", "step2", "step3"
            };
            Priority  priority = Priority.High;
            Severity  severity = Severity.Critical;
            BugStatus status   = BugStatus.Active;
            IBug      bug      = new Bug(title, description, stepsToReproduce, priority, severity, status);

            //Act
            sut.AddWorkItem(bug);
            //Assert
            Assert.AreEqual(sut.WorkItems.Count, 1);
        }
Пример #18
0
        public void AutoPopulateHistory()
        {
            //Arrange
            string        name             = "TestMember";
            var           sut              = new Member(name);
            string        title            = "BugTitle";
            string        description      = "valid description";
            List <string> stepsToReproduce = new List <string> {
                "step1", "step2", "step3"
            };
            Priority  priority = Priority.High;
            Severity  severity = Severity.Critical;
            BugStatus status   = BugStatus.Active;
            IBug      bug      = new Bug(title, description, stepsToReproduce, priority, severity, status);

            //Act
            sut.AddWorkItem(bug);
            //Assert
            Assert.AreEqual(sut.ActivityHistory.Count, 2);
        }
Пример #19
0
        /// <summary>
        /// Create revision based on provided information.
        /// </summary>
        private void ProcessRevision(int number, int revision, DateTime date,
                                     BugType type, BugStatus status, string summary,
                                     BugSeverity?severity, int?priority, Application app,
                                     Module module, SubModule subModule, Release foundRelease, Release targetRelease,
                                     Person contributor, Person leader, Person developer, Person tester)
        {
            // Check prerequisites
            if (app == null)
            {
                throw new Exception(
                          String.Format("Application isn't specified for bug={0}, revision={1}", number, revision));
            }
            if (contributor == null)
            {
                throw new Exception(
                          String.Format("Contributor isn't specified for bug={0}, revision={1}", number, revision));
            }

            Revision rev = new Revision
            {
                BugNumber       = number,
                Rev             = revision,
                Date            = date,
                Type            = type,
                Status          = status,
                Summary         = summary,
                Severity        = severity,
                Priority        = priority,
                AppId           = app.Id,
                ModuleId        = module != null ? (int?)module.Id : null,
                SubModuleId     = subModule != null ? (int?)subModule.Id : null,
                FoundReleaseId  = foundRelease != null ? (int?)foundRelease.Id : null,
                TargetReleaseId = targetRelease != null ? (int?)targetRelease.Id : null,
                ContributorId   = contributor.Id,
                TeamLeaderId    = leader != null ? (int?)leader.Id : null,
                DeveloperId     = developer != null ? (int?)developer.Id : null,
                TesterId        = tester != null ? (int?)tester.Id : null
            };

            m_provider.CreateRevision(rev);
        }
        public void InputBugNameIsNULL_Should()
        {
            string        bugName        = null;
            string        description    = "MegaBadBug";
            List <string> stepsToProduce = new List <string> {
                "steps"
            };
            var bug = new Bug(bugName, description, stepsToProduce);

            database.Bugs.Add(bug);

            BugStatus bugStatus = BugStatus.Active;

            List <string> parameters = new List <string>
            {
                bugName,
                bugStatus.ToString()
            };

            ChangeBugStatusCommand command = new ChangeBugStatusCommand(parameters);

            command.Execute();
        }
Пример #21
0
        public void ValidateWorkItemExists_WithValidData()
        {
            //Arrange
            Validator     validator        = new Validator();
            string        title            = "BugTitle";
            string        description      = "valid description";
            List <string> stepsToReproduce = new List <string> {
                "step1", "step2", "step3"
            };
            Priority  priority = Priority.High;
            Severity  severity = Severity.Critical;
            BugStatus status   = BugStatus.Active;
            var       bug      = new Bug(title, description, stepsToReproduce, priority, severity, status);
            string    name     = "TestBoard";
            var       board    = new Board(name);

            board.AddWorkItem(bug);
            //Act
            var sut = validator.ValidateExists(board.WorkItems, title);

            //Assert
            Assert.AreEqual(bug, sut);
        }
        public void ValidChangeBugStatus_Should()
        {
            string        bugName        = "BugNameShould";
            string        description    = "MegaBadBug";
            List <string> stepsToProduce = new List <string> {
                "steps"
            };
            var bug = new Bug(bugName, description, stepsToProduce);

            database.Bugs.Add(bug);

            BugStatus bugStatus = BugStatus.Fixed;

            List <string> parameters = new List <string>
            {
                bugName,
                bugStatus.ToString()
            };

            ChangeBugStatusCommand command = new ChangeBugStatusCommand(parameters);

            command.Execute();
            Assert.IsTrue(bug.BugStatus.Equals(bugStatus));
        }
Пример #23
0
 /// <summary>
 /// Constructor of Bug
 /// </summary>
 /// <param name="title">Title of Bug</param>
 /// <param name="description">Description of the bug</param>
 /// <param name="stepsToReproduce">Steps to reproduce the bug</param>
 /// <param name="priority">Priority of the bug</param>
 /// <param name="severity">Severity of the bug</param>
 /// <param name="status">Status of the bug</param>
 public Bug(string title, string description, List <string> stepsToReproduce, Priority priority, Severity severity, BugStatus status)
     : base(title, description)
 {
     this.StepsToReproduce = stepsToReproduce;
     this.Priority         = priority;
     this.Severity         = severity;
     this.Status           = status;
 }
Пример #24
0
 public virtual IQueryable <Bug> GetAllByStatus(BugStatus status)
 {
     return(this.DbSet.Where(b => b.Status == status));
 }
Пример #25
0
 /// <summary>
 /// Public constructor.
 /// </summary>
 /// <param name="id">Identified of the Bug.</param>
 /// <param name="status">Status of the Bug.</param>
 public BugInfo(int id, BugStatus status)
 {
     Id     = id;
     Status = status;
 }
Пример #26
0
 public override void UpdateBugStatus(BugStatus newStatus)
 {
     this.BugStatus = newStatus;
     //this.History.Add(new Activity($"'{this.Title}' status changed to {newStatus}"));
 }
Пример #27
0
        //public Bug(string title) : base(title)
        //{
        //    base.Тype = WorkItemType.Bug;
        //}

        public Bug(string title, string description = "description", List <string> steps       = null,
                   PriorityType priority            = PriorityType.None, SeverityType severity = SeverityType.None, BugStatus bugStatus = BugStatus.None, Person assignee = null, List <IComment> comments = null, List <Activity> history = null) :
            base(title, description, assignee, comments, history)
        {
            base.Тype      = WorkItemType.Bug;
            this.Steps     = steps;
            this.Priority  = priority;
            this.Severity  = severity;
            this.BugStatus = bugStatus;
        }
Пример #28
0
 public IQueryable <Bug> GetAllByStatus(BugStatus status)
 {
     return(this.Entities.AsQueryable().Where(b => b.Status == status));
 }
Пример #29
0
        public async Task <IEnumerable <BugItem> > GetBugItems(BugStatus status)
        {
            var bugItems = await _httpClient.GetAsync($"bugs");

            return(JsonConvert.DeserializeObject <IEnumerable <BugItem> >(await bugItems.Content.ReadAsStringAsync()));
        }
Пример #30
0
 public void Resolve(string comments)
 {
     Status = BugStatus.QA;
     DateTime now = DateTime.Now;
     _history.Add(new Tuple<DateTime, List<Tuple<string, string>>, string>(
                      now, new List<Tuple<string, string>>{
                          new Tuple<string, string>("Status", "Resolved")
                      }, comments));
 }
Пример #31
0
        /// <summary>
        /// Reads query results from stream and fills database.
        /// </summary>
        /// <remarks>
        /// Prerequisite for normal functioning of this method
        /// is initialized empty storage. But this particular
        /// method doesn't initialize storage itself. So prior
        /// calling this method storage shall be initialized.
        /// </remarks>
        public void FillStorage(TextReader reader)
        {
            // Create records enumerator from stream
            IEnumerator <Record> records = QueryResultParser.CreateRecordsEnumerator(reader);

            // Initialize caches
            m_appCache       = new Dictionary <string, Application>();
            m_moduleCache    = new Dictionary <ComplexKey, Module>();
            m_subModuleCache = new Dictionary <ComplexKey, SubModule>();
            m_relCache       = new Dictionary <ComplexKey, Release>();
            m_personCache    = new Dictionary <string, Person>();

            int current = 0;

            // Enumerate records (actually revisions)
            while (records.MoveNext())
            {
                // Take current record from parser
                Record record = records.Current;

                // Process number
                int number = ProcessNumber(record);

                // Process revision number
                int revision = ProcessRevisionNumber(record);

                // Process short description
                string summary = ProcessSummary(record);

                // Process date
                DateTime date = ProcessDate(record);

                // Process record type (could be null)
                BugType type = ProcessType(record);

                // Process status
                BugStatus status = ProcessStatus(record);

                // Process severity
                BugSeverity?severity = ProcessSeverity(record);

                // Process priority
                int?priority = ProcessPriority(record);

                // Process application
                Application app = ProcessApp(record);

                Module    module        = null;
                SubModule subModule     = null;
                Release   foundRelease  = null;
                Release   targetRelease = null;
                // Process some fields only if application is specified
                if (app != null)
                {
                    // Process module
                    module = ProcessModule(record, app);
                    // Don't process sub module if module is null
                    if (module != null)
                    {
                        // Process sub
                        subModule = ProcessSubModule(record, module);
                    }

                    // Process found release
                    foundRelease = ProcessRelease(record, app, FoundRelCol);
                    // Process target release
                    targetRelease = ProcessRelease(record, app, TargetRelCol);
                }

                // Process contributor
                Person contributor = ProcessPerson(record, ContributorCol);
                // Process team leader
                Person leader = ProcessPerson(record, LeaderCol);
                // Process developer
                Person developer = ProcessPerson(record, DevCol);
                // Process tester
                Person tester = ProcessPerson(record, QaCol);

                // Process revision
                ProcessRevision(number, revision, date, type, status,
                                summary, severity, priority, app, module,
                                subModule, foundRelease,
                                targetRelease, contributor, leader, developer, tester);

                current++;
                // Notify progress
                FireProgressChanged(current);
            }
        }
 public IBug CreateBug(string title, string description, List <string> stepsToReproduce, Priority priority, Severity severity, BugStatus status)
 {
     return(new Bug(title, description, stepsToReproduce, priority, severity, status));
 }
Пример #33
0
 public IQueryable <Bug> GetByStatus([FromUri]
                                     BugStatus type)
 {
     return(this.BugLoggerData.Bugs.GetAllByStatus(type));
 }
Пример #34
0
 public Bug(string title, string description, List <string> steps, Priority priority, Severity severity, BugStatus status, IMember assignee)
     : base(title, description)
 {
     this.Steps    = steps;
     this.Severity = severity;
     this.Priority = priority;
     this.Status   = status;
     this.Assignee = assignee;
 }
Пример #35
0
 public IEnumerable <BugItem> GetBugs(BugStatus status)
 {
     return(_bugItems);
 }
Пример #36
0
        public IHttpActionResult ChangeStatus(int id, BugStatus newStatus)
        {
            var bugFromDb = this.BugLoggerData.Bugs.Find(id);
            if (bugFromDb == null)
            {
                return this.BadRequest(string.Format("Bug with id={0} does not exists.", id));
            }

            bugFromDb.Status = newStatus;
            this.BugLoggerData.SaveChanges();

            return this.Ok(bugFromDb);
        }