public void GetNewRetrievalId_ExistingId_Valid()
        {
            // Arrange
            string expectedPrefix = $"RET-{DateTime.Now.Year}{DateTime.Now.Month:00}";
            var    previous       = IdService.GetNewRetrievalId(context);

            new RetrievalRepository(context).Save(new Retrieval()
            {
                RetrievalId     = previous,
                Status          = new StatusService(context).FindStatusByStatusId(16),
                CreatedDateTime = DateTime.Now.AddDays(1 - DateTime.Today.Day),
            });

            // Act
            var current = IdService.GetNewRetrievalId(context);

            new RetrievalRepository(context).Save(new Retrieval()
            {
                RetrievalId     = current,
                Status          = new StatusService(context).FindStatusByStatusId(16),
                CreatedDateTime = DateTime.Now,
            });
            var previousSerialNoParseResult = Int32.TryParse(previous.Substring(previous.Length - 3), out int previousSerialNo);
            var resultSerialNoParseResult   = Int32.TryParse(current.Substring(current.Length - 3), out int resultSerialNo);

            // Assert
            Assert.AreEqual(1, resultSerialNo - previousSerialNo);
        }
        public void GetNewRetrievalIdTest()
        {
            // Arrange
            string expectedPrefix = $"RET-{DateTime.Now.Year}{DateTime.Now.Month:00}";

            // Act
            var result = IdService.GetNewRetrievalId(context);
            var serialNoParseResult = Int32.TryParse(result.Substring(result.Length - 3), out int serialNo);

            // Assert
            Assert.AreEqual(expectedPrefix, result.Substring(0, 10));
            Assert.IsTrue(serialNoParseResult);
        }
        public void SaveTest()
        {
            //Arrange
            Retrieval newRetrieval = new Retrieval();

            newRetrieval.RetrievalId     = IdService.GetNewRetrievalId(context);
            newRetrieval.CreatedDateTime = DateTime.Now;
            string expected = newRetrieval.RetrievalId;

            //Act
            var result = retrievalService.Save(newRetrieval);

            retrievalRepository.Delete(newRetrieval);

            //Assert
            Assert.AreEqual(expected, result.RetrievalId);
        }