public async void Execute_WithCorrectModel_Successful()
        {
            // arrange
            var issueModel = new IssueModel
            {
                UserId  = Guid.NewGuid(),
                Title   = "title",
                Content = "content"
            };

            User existingUser = new User {
                Id = issueModel.UserId
            };

            this.userAccessMock
            .Setup(x => x.TryGetById(issueModel.UserId))
            .Returns(new Maybe <User>(existingUser));

            this.issueAccessMock
            .Setup(x => x.Update(issueModel.Id, issueModel.Title, issueModel.Content, false));

            var command = this.commandRepository.UpdateIssue(issueModel);

            // act
            var commandResult = await this.CommandExecutor.ExecuteAsync(command);

            // assert
            CommandAssert.IsSuccessful(commandResult);
        }
Ejemplo n.º 2
0
 internal FeedbackItemViewModel(IssueModel issue, Action gotoAction)
 {
     Title       = issue.Title;
     ImageUrl    = issue.User.AvatarUrl;
     Created     = issue.CreatedAt;
     GoToCommand = ReactiveCommand.Create().WithSubscription(_ => gotoAction());
 }
Ejemplo n.º 3
0
            private void GetDiagnostics()
            {
                if ((Data.Apps & JpegApps.Jfif) != 0)
                {
                    // This spec is often violated.
                    if (Data.DensityX == 0 || Data.DensityY == 0)
                    {
                        IssueModel.Add($"Invalid JFIF density of {Data.DensityX}x{Data.DensityY}", Severity.Trivia);
                    }

                    if ((int)Data.Units > 2)
                    {
                        IssueModel.Add($"Invalid JFIF units of {Data.Units}", Severity.Warning);
                    }
                }

                if (Data.eoiPos == null)
                {
                    IssueModel.Add("Missing end marker");
                }
                else
                if (Data.ExcessSize == 0)
                {
                    var unparsedSize = Data.FileSize - Data.ValidSize;
                    if (unparsedSize > 0)
                    {
                        IssueModel.Add($"Possible watermark, size={unparsedSize}", Severity.Advisory);
                    }
                }
            }
Ejemplo n.º 4
0
        /// <summary>
        /// saves issue to DA-layer
        /// preperations are don here
        /// </summary>
        /// <param name="issueModel"></param>
        /// <param name="userId">user who is performing operation (owner)</param>
        /// <param name="selfAssessmentValue">self assessment value of issue creator</param>
        /// <param name="selfAssessmentDescr">self assessment description of isssue creator</param>
        /// <returns></returns>
        public int SaveIssue(IssueModel issueModel, int userId, double selfAssessmentValue, string selfAssessmentDescr)
        {
            Issue issue   = issueModel.ToEntity();
            int   issueId = -1;

            if (issue.Parent == -1)
            {
                issue.Parent = null;
            }
            if (issue.DependsOn == -1)
            {
                issue.DependsOn = null;
            }
            if (issue.Id > 0)
            {
                issueId = IssueOp.UpdateIssue(issue, userId);
                if (issueModel.Status == "CREATING" || issueModel.Status == "BRAINSTORMING1")
                {
                    AccessRightOp.UpdateSelfAssesment(selfAssessmentValue, selfAssessmentDescr, issueModel.Id, userId);
                }
                return(issueId);
            }
            else
            {
                issueId = IssueOp.InsertIssue(issue, userId, selfAssessmentValue, selfAssessmentDescr);
                return(issueId);
            }
        }
Ejemplo n.º 5
0
        public IHttpActionResult GetById(int id)
        {
            //Lista de tipo iterador
            IssueModel issue = null;

            using (var context = new Entity())
            {
                issue = context.Issue
                        .Where(IssueItem => IssueItem.Id == id)
                        .Select(IssueItem => new IssueModel()
                {
                    Id                  = IssueItem.Id,
                    Description         = IssueItem.Description,
                    RegisterTimestamp   = IssueItem.RegisterTimestamp,
                    Address             = IssueItem.Address,
                    ContactPhone        = IssueItem.ContactPhone,
                    ContactEmail        = IssueItem.ContactEmail,
                    Status              = IssueItem.Status,
                    SupportUserAssigned = IssueItem.SupportUserAssigned,
                    IdClient            = IssueItem.IdClient,
                    Service             = IssueItem.Service
                }).FirstOrDefault <IssueModel>();
            }
            if (issue == null)
            {
                return(NotFound());
            }

            return(Ok(issue));
        }
Ejemplo n.º 6
0
        public VwbResponseModel CreateIssueFromModel(IssueModel model)
        {
            model.Title = model.Title.HasContent() ? model.Title : "New Issue";
            Guid issueId;

            try
            {
                issueId = CreateIssueItem <IIssue, IIssue_Folder>(model.Title, Constants.VirtualWhiteboardIssuesFolder);
                UpdateIssueItem(model, issueId);
            }
            catch (Exception ex)
            {
                return(new VwbResponseModel
                {
                    IsSuccess = false,
                    FriendlyErrorMessage =
                        "Creation of new Issue failed.  Reload the Virtual Whiteboard and try again. "
                        + "If the problem persists, please contact your systems administrator.",
                    DebugErrorMessage = ex.Message
                });
            }

            return(new VwbResponseModel {
                IsSuccess = true, IssueId = issueId
            });
        }
Ejemplo n.º 7
0
            protected void GetDiagnostics(string repairPrompt = null, Func <bool, string> repairer = null, bool isRepairing = false)
            {
                if (Data.MissingCount == null)
                {
                    return;
                }

                Severity  sev = Severity.Advisory;
                IssueTags tag;
                var       sfx = Data.Files.Items.Count == 1 ? String.Empty : "s";
                var       msg = $"Existence check{sfx} of {Data.Files.Items.Count} file{sfx}";

                if (Data.MissingCount.Value == 0)
                {
                    msg         += " successful.";
                    tag          = IssueTags.Success;
                    repairPrompt = null;
                    repairer     = null;
                }
                else
                {
                    msg += $" failed with {Data.MissingCount} not found.";
                    sev  = repairPrompt != null && isRepairing ? Severity.Warning : Severity.Error;
                    tag  = IssueTags.Failure;
                }

                Data.FcIssue = IssueModel.Add(msg, sev, tag, repairPrompt, repairer);
            }
Ejemplo n.º 8
0
        /// <summary>
        /// retuns issueModel by issue id
        /// </summary>
        /// <param name="issueId"></param>
        /// <returns>IssueModel</returns>
        public IssueModel GetIssue(int issueId)
        {
            IssueModel im = new IssueModel();

            im = im.ToModel(IssueOp.GetIssueById(issueId));
            if (im.Parent != null)
            {
                int parrentIssueId = Convert.ToInt32(im.Parent);
                im.ParentTitle = IssueOp.GetIssueById(parrentIssueId).Title;
            }
            else
            {
                im.Parent = -1;
            }
            if (im.DependsOn != null)
            {
                int dependsOnIssueId = Convert.ToInt32(im.DependsOn);
                im.DependsOnTitle = IssueOp.GetIssueById(dependsOnIssueId).Title;
            }
            else
            {
                im.DependsOn = -1;
            }

            TagModel tm = new TagModel();

            im.Tags = tm.ToModelList(TagOp.GetIssueTags(issueId), tm);

            return(im);
        }
Ejemplo n.º 9
0
        public JsonResult CapNhatVanDe()
        {
            IssueModel IM = new IssueModel();

            IM.VanDeID       = Int32.Parse(Request.Form["VanDeID"].ToString());
            IM.DuAnID        = Int32.Parse(Request.Form["DuAnID"].ToString());
            IM.LoaiVanDeID   = Int32.Parse(Request.Form["LoaiVanDe"].ToString());
            IM.TenVanDe      = Request.Form["TenVanDe"].ToString();
            IM.MoTa          = Request.Form["MoTa"].ToString();
            IM.TrangThai     = Int32.Parse(Request.Form["TrangThai"].ToString());
            IM.NguoiThucHien = Request.Form["NguoiThucHien"].ToString();
            IM.NgayBatDau    = Request.Form["NgayBatDau"].ToString();
            IM.NgayKetThuc   = Request.Form["NgayKetThuc"].ToString();
            IM.SoGioDuKien   = Int32.Parse(Request.Form["SoGioDuKien"].ToString());
            IM.SoGioThucTe   = Int32.Parse(Request.Form["SoGioThucTe"].ToString());
            IM.NguoiCapNhat  = Session["UserName"].ToString();

            ResData res = IssueModel.CapNhatVanDe(IM);

            if (res.ResultID > 0)
            {
                SendMail(res.ResultVanDeID, res.ResultID);
            }

            return(Json(res, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
        public ActionResult ListUsers()
        {
            List <UserModel>  users  = new List <UserModel>();
            List <IssueModel> issues = new List <IssueModel>();

            UserModel user1 = new UserModel("User1");

            users.Add(user1);
            UserModel user2 = new UserModel("User2");

            users.Add(user2);
            UserModel user3 = new UserModel("User3");

            users.Add(user3);

            IssueModel issue1 = new IssueModel("issue1", "description of issue1", user1);

            issues.Add(issue1);
            IssueModel issue11 = new IssueModel("issue11", "description of issue11", issue1.AddedUsers.First(), issue1, IssueDifficulty.Easy);

            issues.Add(issue11);
            IssueModel issue12 = new IssueModel("issue12", "description of issue12", issue1.AddedUsers.First(), issue1, IssueDifficulty.Hard);

            issues.Add(issue12);

            issue11.Progress = 0.5;
            issue12.Progress = 0.7;

            return(View(users));
        }
Ejemplo n.º 11
0
        public UserInfoView(UserModel userModel, IssueModel issueModel, ProjectModel projectModel, ProjectMemberModel projectMemberModel)
            : base(userModel, issueModel, projectModel, projectMemberModel)
        {
            InitializeComponent();
            this.userModel          = userModel;
            this.issueModel         = issueModel;
            this.projectModel       = projectModel;
            this.projectMemberModel = projectMemberModel;
            userController          = new UserController(userModel);
            issueController         = new IssueController(userModel, issueModel, projectModel);

            user = SecurityModel.getInstance().AuthenticatedUser;

            userModel.userDataChanged       += updateView;
            issueModel.issueDataChanged     += updateView;
            projectModel.projectDataChanged += updateView;

            errorProvider            = new ErrorProvider();
            errorProvider.BlinkStyle = ErrorBlinkStyle.NeverBlink;

            if (this.Owner == null)
            {
                base.logoutToolStripButton.Visible = true;
                base.logoutToolStripButton.Enabled = true;
            }
        }
Ejemplo n.º 12
0
        public async Task <IssueModel> AddIssue(int libraryId, int periodicalId, IssueModel issue, CancellationToken cancellationToken)
        {
            int id;

            using (var connection = _connectionProvider.GetConnection())
            {
                var sql = "INSERT Into Issue (PeriodicalId, Volumenumber, IssueNumber, IsPublic, ImageId, IssueDate) " +
                          "OUTPUT Inserted.Id " +
                          "VALUES (@PeriodicalId, @Volumenumber, @IssueNumber, @IsPublic, @ImageId, @IssueDate)";
                var parameter = new
                {
                    LibraryId    = libraryId,
                    PeriodicalId = periodicalId,
                    Volumenumber = issue.VolumeNumber,
                    IssueNumber  = issue.IssueNumber,
                    IssueDate    = issue.IssueDate,
                    IsPublic     = issue.IsPublic,
                    ImageId      = issue.ImageId
                };
                var command = new CommandDefinition(sql, parameter, cancellationToken: cancellationToken);
                id = await connection.ExecuteScalarAsync <int>(command);
            }

            return(await GetIssueById(libraryId, periodicalId, id, cancellationToken));
        }
Ejemplo n.º 13
0
        public CreateIssueView(UserModel userModel, IssueModel issueModel, ProjectModel projectModel, ProjectMemberModel projectMemberModel)
            : base(userModel, issueModel, projectModel, projectMemberModel)
        {
            InitializeComponent();
            this.userModel          = userModel;
            this.issueModel         = issueModel;
            this.projectModel       = projectModel;
            this.projectMemberModel = projectMemberModel;

            issueController         = new IssueController(userModel, issueModel, projectModel);
            projectMemberController = new ProjectMemberController(projectMemberModel, userModel);
            user = SecurityModel.getInstance().AuthenticatedUser;
            userModel.updateAuthenticatedUser(user.UserId);
            projectList = user.JoinedProjects;
            foreach (Project project in projectList)
            {
                projectComboBox.Items.Add(project);
            }
            if (projectList.Count > 0)
            {
                projectComboBox.SelectedIndex = 0;
            }
            issuePriorityComboBox.SelectedIndex = 0;
            issueSeverityComboBox.SelectedIndex = 0;
        }
Ejemplo n.º 14
0
        public static List <IssueModel> ReaderDaysIssue(int readDataDays)
        {
            List <IssueModel> result = new List <IssueModel>();

            try
            {
                string    beginIssue = DateTime.Now.AddDays(0 - readDataDays).ToString("yyyyMMdd") + "001";
                string    sql        = "select * from cqssc where issue>=" + beginIssue + "  order by issue desc";
                DataTable dt         = SqLiteHelper.getBLLInstance().ExecuteTable(sql, null);
                if (dt != null && dt.Rows.Count > 0)
                {
                    foreach (DataRow row in dt.Rows)
                    {
                        IssueModel dm = new IssueModel();
                        dm.StrIssue = row["issue"].ToString();
                        dm.Wan      = int.Parse(row["wan"].ToString());
                        dm.Qian     = int.Parse(row["qian"].ToString());
                        dm.Bai      = int.Parse(row["bai"].ToString());
                        dm.Shi      = int.Parse(row["shi"].ToString());
                        dm.Ge       = int.Parse(row["ge"].ToString());
                        dm.OpenCode = row["opencode"].ToString();
                        dm.OpenTime = row["opentime"].ToString();
                        dm.sync     = int.Parse(row["sync"].ToString());
                        result.Add(dm);
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 15
0
            protected void GetDiagnostics()
            {
                if (Data.Moov == 0)
                {
                    IssueModel.Add("Missing 'moov' section.", Severity.Error);
                }

                if (Data.Mdat == 0)
                {
                    IssueModel.Add("Missing 'mdat' section.", Severity.Error);
                }

                // Wide boxes are rare.
                if (Data.Wide != 0)
                {
                    IssueModel.Add($"Number of wide boxes={Data.Wide}.", Severity.Noise);
                }

                if (Data.ExcessSize == 0)
                {
                    var unparsedSize = Data.FileSize - Data.ValidSize;
                    if (unparsedSize != 0)
                    {
                        IssueModel.Add($"Possible watermark, size={unparsedSize}.", Severity.Advisory);
                    }
                }
            }
 public static ErrorData OnDeleteHistory(
     Context context,
     SiteSettings ss,
     IssueModel issueModel,
     bool api = false)
 {
     if (!Parameters.History.PhysicalDelete)
     {
         return(new ErrorData(type: Error.Types.InvalidRequest));
     }
     if (!context.CanManageSite(ss: ss))
     {
         return(new ErrorData(type: Error.Types.HasNotPermission));
     }
     if (api && (context.ContractSettings.Api == false || !Parameters.Api.Enabled))
     {
         return(new ErrorData(type: Error.Types.InvalidRequest));
     }
     if (ss.LockedRecord())
     {
         return(new ErrorData(
                    type: Error.Types.LockedRecord,
                    data: new string[]
         {
             issueModel.IssueId.ToString(),
             ss.LockedRecordUser.Name,
             ss.LockedRecordTime.DisplayValue.ToString(context.CultureInfo())
         }));
     }
     return(new ErrorData(type: Error.Types.None));
 }
Ejemplo n.º 17
0
        public JsonResult GetList(string TenVanDe)
        {
            string            TenDangNhap = Session["UserName"].ToString();
            List <IssueModel> lst         = IssueModel.GetList(TenDangNhap, TenVanDe);

            return(Json(lst, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 18
0
            public Model(Stream stream, string path)
            {
                base._data = Data = new GifFormat(this, stream, path);

                // Arbitrary sanity limit.
                if (Data.FileSize > 50000000)
                {
                    IssueModel.Add("File size insanely huge", Severity.Fatal);
                    return;
                }

                Data.fBuf = new byte[(int)Data.FileSize];

                stream.Position = 0;
                int got = stream.Read(Data.fBuf, 0, (int)Data.FileSize);

                if (got < Data.FileSize)
                {
                    IssueModel.Add("Read failed.", Severity.Fatal);
                    return;
                }

                Data.Version = Data.fBuf[4] == '7'? "87a" : "89a";
                Data.Width   = ConvertTo.FromLit16ToInt32(Data.fBuf, 6);
                Data.Height  = ConvertTo.FromLit16ToInt32(Data.fBuf, 8);
            }
Ejemplo n.º 19
0
            public override void CalcHashes(Hashes hashFlags, Validations validationFlags)
            {
                if ((hashFlags & Hashes.Intrinsic) != 0 && Data.BadCrcCount == null)
                {
                    Data.BadCrcCount = 0;
                    var hasher = new Crc32rHasher();
                    int pos    = 12;
                    for (int ix = 0; ix < Data.Chunks.Items.Count; ++ix)
                    {
                        PngChunk chunk = Data.Chunks.Items[ix];
                        hasher.Append(Data.fBuf, pos, (int)chunk.Size + 4);
                        byte[] hash      = hasher.GetHashAndReset();
                        UInt32 actualCRC = BitConverter.ToUInt32(hash, 0);
                        ChunksModel.SetActualCRC(ix, actualCRC);

                        if (actualCRC != chunk.StoredCRC)
                        {
                            ++Data.BadCrcCount;
                        }
                        pos += (int)chunk.Size + 12;
                    }

                    var sb = new StringBuilder();
                    sb.Append(Data.Chunks.Items.Count - Data.BadCrcCount);
                    sb.Append(" of ");
                    sb.Append(Data.Chunks.Items.Count);
                    sb.Append(" CRC checks successful.");
                    IssueModel.Add(sb.ToString(), Data.BadCrcCount == 0? Severity.Noise : Severity.Error);
                }

                base.CalcHashes(hashFlags, validationFlags);
            }
Ejemplo n.º 20
0
        public IHttpActionResult GetById(int id)
        {
            IssueModel issue = null;

            using (var context = new Entities())
            {
                issue = context.Issue1
                        .Where(issueItem => issueItem.id == id)
                        .Select(issueItem => new IssueModel()
                {
                    id                = issueItem.id,
                    ReportNumber      = issueItem.ReportNumber,
                    Status            = issueItem.Status,
                    RaportTimestamp   = issueItem.RaportTimestamp,
                    ResolutionComment = issueItem.ResolutionComment,
                    SupervisorId      = issueItem.SupervisorId
                }).FirstOrDefault <IssueModel>();
            }
            //to do : transform this snippet into a single return
            if (issue == null)
            {
                return(NotFound());
            }
            return(Ok(issue));
        }
Ejemplo n.º 21
0
        public CommandBase UpdateIssue(IssueModel issueModel)
        {
            var command = this.commandFactory.CreateCommand <UpdateIssueCommand>();

            command.Initialize(issueModel);
            return(command);
        }
Ejemplo n.º 22
0
            private void TagCheckText(string key, bool optional = false)
            {
                string err   = null;
                string value = Data.GetTagValue(key);

                if (String.IsNullOrEmpty(value))
                {
                    if (!optional)
                    {
                        err = key + " tag is missing";
                    }
                }
                else
                {
                    if (value.StartsWith(" "))
                    {
                        err = key + " tag has leading space";
                    }
                    if (value.EndsWith(" "))
                    {
                        err = (err == null ? key + " tag has" : err + ',') + " trailing space";
                    }
                    if (value.Contains("  "))
                    {
                        err = (err == null ? key + " tag has" : err + ',') + " adjacent spaces";
                    }
                }
                if (err != null)
                {
                    IssueModel.Add(err + ".", Severity.Warning, IssueTags.BadTag | IssueTags.StrictErr);
                }
            }
Ejemplo n.º 23
0
            protected override void GetDiagnostics()
            {
                base.GetDiagnostics();

                Severity  sev;
                IssueTags tag;

                if (Data.ArIssue == null)
                {
                    if (Data.AccurateRipConfidence < 0)
                    {
                        sev = Severity.Error; tag = IssueTags.Failure;
                    }
                    else
                    {
                        sev = Severity.Advisory; tag = Data.AccurateRipConfidence > 0 ? IssueTags.Success : IssueTags.None;
                    }
                    Data.ArIssue = IssueModel.Add($"AccurateRip {Data.AccurateRipText}.", sev, tag);
                }

                if (Data.storedHash == null)
                {
                    IssueModel.Add("No signature.", Severity.Trivia, IssueTags.StrictErr);
                }
            }
Ejemplo n.º 24
0
        public CommandBase <IssueModel> CreateNewIssue(IssueModel issueModel)
        {
            var command = this.commandFactory.CreateCommand <CreateNewIssueCommand, IssueModel>();

            command.Initialize(issueModel);
            return(command);
        }
Ejemplo n.º 25
0
        public static ErrorData OnEditing(
            Context context, SiteSettings ss, IssueModel issueModel, bool api = false)
        {
            if (api)
            {
                if ((context.ContractSettings.Api == false || !Parameters.Api.Enabled))
                {
                    return(new ErrorData(type: Error.Types.InvalidRequest));
                }
                if (context.InvalidJsonData)
                {
                    return(new ErrorData(type: Error.Types.InvalidJsonData));
                }
            }
            switch (issueModel.MethodType)
            {
            case BaseModel.MethodTypes.Edit:
                return
                    (context.CanRead(ss: ss) &&
                     issueModel.AccessStatus != Databases.AccessStatuses.NotFound
                            ? new ErrorData(type: Error.Types.None)
                            : new ErrorData(type: Error.Types.NotFound));

            case BaseModel.MethodTypes.New:
                return(context.CanCreate(ss: ss)
                        ? new ErrorData(type: Error.Types.None)
                        : !context.CanRead(ss: ss)
                            ? new ErrorData(type: Error.Types.NotFound)
                            : new ErrorData(type: Error.Types.HasNotPermission));

            default:
                return(new ErrorData(type: Error.Types.NotFound));
            }
        }
Ejemplo n.º 26
0
            public Model(Stream stream, string path)
            {
                base._tracksModel = new LogXldTrack.Vector.Model();
                base._data        = Data = new LogXldFormat(this, stream, path);

                // Arbitrary limit.
                if (Data.FileSize > 250000)
                {
                    IssueModel.Add("File insanely huge.", Severity.Fatal);
                    return;
                }

                Data.fBuf         = new byte[Data.FileSize];
                Data.fbs.Position = 0;
                var got = Data.fbs.Read(Data.fBuf, 0, (int)Data.FileSize);

                if (got != Data.FileSize)
                {
                    IssueModel.Add("Read failed", Severity.Fatal);
                    return;
                }

                Parse(new LogBuffer(Data.fBuf, Encoding.ASCII));
                GetDiagnostics();
            }
Ejemplo n.º 27
0
 private void TagCheckTextIsSame(IList <FlacFormat> flacs, string key)
 {
     if (FlacFormat.IsFlacMultiTagAllSame(flacs, key) == false)
     {
         IssueModel.Add(key + " tags are inconsistent.", Severity.Warning, IssueTags.BadTag | IssueTags.StrictErr);
     }
 }
Ejemplo n.º 28
0
            protected virtual void GetDiagnostics()
            {
                if (TracksModel.HasTrackNumberGap())
                {
                    Data.NrIssue = IssueModel.Add("Gap detected in track numbers.", Severity.Error, IssueTags.Failure);
                }

                TracksModel.CountTestCopy();
                if (TracksModel.Data.CopyCount != TracksModel.GetCount())
                {
                    Data.TkIssue = IssueModel.Add("Copy pass incomplete.", Severity.Error, IssueTags.Failure);
                }
                else if (TracksModel.Data.TestCount == 0)
                {
                    Data.TpIssue = IssueModel.Add("Test pass not performed.", Severity.Noise, IssueTags.StrictErr);
                }
                else if (TracksModel.Data.TestCount != TracksModel.GetCount())
                {
                    Data.TpIssue = IssueModel.Add("Test pass incomplete.", Severity.Error, IssueTags.Failure);
                }
                else if (TracksModel.Data.TestMismatchCount != 0)
                {
                    Data.TpIssue = IssueModel.Add("Test/copy CRC-32 mismatch.", Severity.Error, IssueTags.Failure);
                }
                else
                {
                    Data.TkIssue = IssueModel.Add("Test/copy CRC-32s match for all tracks.", Severity.Trivia, IssueTags.Success);
                }
            }
Ejemplo n.º 29
0
        public static void SendTestResult(string epamJiraTag, ScenarioContext context)
        {
            testTime[epamJiraTag].Stop();
            var issueModel = new IssueModel
            {
                Key            = epamJiraTag,
                Time           = testTime[epamJiraTag].ElapsedMilliseconds,
                IsTestComplete = true
            };

            switch (context.ScenarioExecutionStatus)
            {
            case ScenarioExecutionStatus.TestError:
                FailedTest(issueModel, context);
                issueModel.IsTestComplete = false;
                break;

            case ScenarioExecutionStatus.OK:
                PassedTest(issueModel, context);
                break;

            case ScenarioExecutionStatus.UndefinedStep:
                MissingStep(issueModel, context);
                issueModel.IsTestComplete = false;
                break;

            default:
                SkippedTest(issueModel, context);
                issueModel.IsTestComplete = false;
                break;
            }
        }
Ejemplo n.º 30
0
            public override void CalcHashes(Hashes hashFlags, Validations validationFlags)
            {
                if (Data.Issues.HasFatal)
                {
                    return;
                }

                if ((hashFlags & Hashes.Intrinsic) != 0 && Data.History != null && Data.History.ActualCRC == null)
                {
                    var hasher = new Crc32rHasher();
                    hasher.Append(Data.fbs, 0, (int)Data.mediaPosition, (int)Data.mediaPosition + 8, Data.FileSize - Data.mediaPosition - 8);
                    byte[] hash = hasher.GetHashAndReset();
                    HistoryModel.SetActualSelfCRC(BitConverter.ToUInt32(hash, 0));

                    if (Data.History.ActualCRC == Data.History.StoredCRC)
                    {
                        IssueModel.Add("Self-CRC check successful.", Severity.Noise);
                    }
                    else
                    {
                        IssueModel.Add("Self-CRC mismatch, file has been modified.");
                    }
                }

                base.CalcHashes(hashFlags, validationFlags);
            }
Ejemplo n.º 31
0
 protected IssueElement CreateElement(IssueModel x)
 {
     var weakVm = new WeakReference<IBaseIssuesViewModel>(ViewModel);
     var isPullRequest = x.PullRequest != null && !(string.IsNullOrEmpty(x.PullRequest.HtmlUrl));
     var assigned = x.Assignee != null ? x.Assignee.Login : "******";
     var kind = isPullRequest ? "Pull" : "Issue";
     var commentString = x.Comments == 1 ? "1 comment" : x.Comments + " comments";
     var el = new IssueElement(x.Number.ToString(), x.Title, assigned, x.State, commentString, kind, x.UpdatedAt);
     el.Tapped += () => weakVm.Get()?.GoToIssueCommand.Execute(x);
     return el;
 }
Ejemplo n.º 32
0
        protected MonoTouch.Dialog.Element CreateElement(IssueModel x)
        {
            var isPullRequest = x.PullRequest != null && !(string.IsNullOrEmpty(x.PullRequest.HtmlUrl));
            var assigned = x.Assignee != null ? x.Assignee.Login : "******";
            var kind = isPullRequest ? "Pull" : "Issue";
            var commentString = x.Comments == 1 ? "1 comment".t() : x.Comments + " comments".t();
            var el = new IssueElement(x.Number.ToString(), x.Title, assigned, x.State, commentString, kind, x.UpdatedAt);
            el.Tag = x;

            el.Tapped += () => {
                //Make sure the first responder is gone.
                View.EndEditing(true);
                ViewModel.GoToIssueCommand.Execute(x);
            };

            return el;
        }
Ejemplo n.º 33
0
        internal IssueItemViewModel(IssueModel issue)
        {
            var isPullRequest = issue.PullRequest != null && !(string.IsNullOrEmpty(issue.PullRequest.HtmlUrl));
            var s1 = issue.Url.Substring(issue.Url.IndexOf("/repos/", StringComparison.Ordinal) + 7);
            var repoId = new RepositoryIdentifier(s1.Substring(0, s1.IndexOf("/issues", StringComparison.Ordinal)));

            RepositoryFullName = repoId.Owner + "/" + repoId.Name;
            RepositoryName = repoId.Name;
            RepositoryOwner = repoId.Owner;
            IsPullRequest = isPullRequest;
            Title = issue.Title;
            Number = (int)issue.Number;
            State = issue.State;
            Comments = issue.Comments;
            Assignee = issue.Assignee != null ? issue.Assignee.Login : "******";
            UpdatedAt = issue.UpdatedAt;
            GoToCommand = ReactiveCommand.Create();
        }
Ejemplo n.º 34
0
        private IssueItemViewModel CreateItemViewModel(IssueModel issue)
        {
            var item = new IssueItemViewModel(issue);
            if (item.IsPullRequest)
            {
                item.GoToCommand.Subscribe(_ => {
                    var vm = this.CreateViewModel<PullRequestViewModel>();
                    vm.Init(item.RepositoryOwner, item.RepositoryName, item.Number);
                    vm.IssueUpdated.Subscribe(x => UpdateIssue(x));
                    NavigateTo(vm);
                });
            }
            else
            {
                item.GoToCommand.Subscribe(_ => {
                    var vm = this.CreateViewModel<IssueViewModel>();
                    vm.Init(item.RepositoryOwner, item.RepositoryName, item.Number);
                    vm.IssueUpdated.Subscribe(x => UpdateIssue(x));
                    NavigateTo(vm);
                });
            }

            return item;
        }
Ejemplo n.º 35
0
 protected virtual bool IssueFilter(IssueModel issue)
 {
     return issue.Title.ContainsKeyword(SearchKeyword);
 }