Пример #1
0
        public ClosingRemark GetClosingRemark(string closingRemarkId)
        {
            ClosingRemark ClosingRemark = _context.ClosingRemarks.FirstOrDefault(closingRemark => closingRemark.Id.Equals(closingRemarkId));

            if (ClosingRemark == null)
            {
                throw new NotFoundInDBException($"ClosingRemark not found: {closingRemarkId}");
            }
            return(ClosingRemark);
        }
Пример #2
0
        public void GetExists()
        {
            ClosingRemarkService closingRemarkService = new ClosingRemarkService(fixture.context);
            ParticipantService   participantService   = new ParticipantService(fixture.context);
            Participant          participant          = participantService.GetAll().First();
            ActionService        actionService        = new ActionService(fixture.context);
            Action action = actionService.GetAll().First();

            ClosingRemark ClosingRemarkCreate = closingRemarkService.Create(participant, "text", action);

            ClosingRemark ClosingRemarkGet = closingRemarkService.GetClosingRemark(ClosingRemarkCreate.Id);

            Assert.Equal(ClosingRemarkCreate, ClosingRemarkGet);
        }
Пример #3
0
        protected ClosingRemark CreateClosingRemark(
            string actionId,
            string text = null)
        {
            if (text == null)
            {
                text = Randomize.String();
            }

            ClosingRemark remark = _mutation.CreateClosingRemark(
                actionId: actionId,
                text: text
                );

            return(remark);
        }
Пример #4
0
        private static List <ClosingRemark> GetClosingRemarks()
        {
            var closingRemark1 = new ClosingRemark
            {
                Text       = "ClosingRemark1",
                CreateDate = DateTimeOffset.UtcNow,
                Action     = Actions[0],
                CreatedBy  = Participants[0]
            };
            var closingRemark2 = new ClosingRemark
            {
                Text       = "ClosingRemark2",
                CreateDate = DateTimeOffset.UtcNow,
                Action     = Actions[0],
                CreatedBy  = Participants[0]
            };

            return(new List <ClosingRemark>(new ClosingRemark[] { closingRemark1, closingRemark2 }));
        }
Пример #5
0
        public ClosingRemark Create(
            Participant createdBy,
            string text,
            Action action
            )
        {
            DateTimeOffset createDate = DateTimeOffset.UtcNow;

            ClosingRemark newClosingRemark = new ClosingRemark
            {
                CreateDate = createDate,
                Text       = text,
                CreatedBy  = createdBy,
                Action     = action
            };

            _context.ClosingRemarks.Add(newClosingRemark);

            _context.SaveChanges();
            return(newClosingRemark);
        }