public void ShouldUpdateCode()
        {
            Nonconformity nonconformity = new Nonconformity("Controlled materials stored without proper indication.");

            nonconformity.UpdateCode("2019:02:05");
            Assert.Equal("2019:02:05", nonconformity.Code);
        }
        private Nonconformity UpdateCodeWhenAdd(Nonconformity nonconformity)
        {
            var code = string.Concat((System.DateTime.UtcNow.Year) + ":" + nonconformity.Id.ToString("D2") + ":"
                                     + nonconformity.Version.ToString("D2"));

            nonconformity.UpdateCode(code);
            _nonconformityRepository.Update(nonconformity);

            return(nonconformity);
        }
示例#3
0
        private Nonconformity UpdateCodeWhenAddNewVersionOfInconformity(Nonconformity addedNonconformity,
                                                                        int oldNonconformityId)
        {
            var code = string.Concat((DateTime.UtcNow.Year) + ":" + oldNonconformityId.ToString("D2") + ":"
                                     + addedNonconformity.Version.ToString("D2"));

            addedNonconformity.UpdateCode(code);
            _context.Nonconformities.Update(addedNonconformity);
            _context.SaveChanges();
            return(addedNonconformity);
        }