public void GetCurrentDateTime_CalledTwice_SecondReturnedTimeBiggerThanFirstReturned()
        {
            const Int32 timeout = 100;

            var firstTime = _dateWrapper.GetCurrentDateTime();

            Thread.Sleep(timeout);
            var secondTime = _dateWrapper.GetCurrentDateTime();

            Assert.That(secondTime, Is.GreaterThan(firstTime));
        }
Esempio n. 2
0
        public async Task <Note> UpdateAsync(Guid updateNoteId, Note note)
        {
            var persistedNote = await _retrievalService.GetByIdAsync(updateNoteId);

            var noteToUpdate = new Note
            {
                Id                   = updateNoteId,
                Text                 = note.Text,
                CreationDate         = persistedNote.CreationDate,
                LastModificationDate = _dateWrapper.GetCurrentDateTime()
            };

            return(await _repository.UpdateAsync(noteToUpdate));
        }
Esempio n. 3
0
        public async Task <Note> CreateAsync(Note note)
        {
            var dateTime = _dateWrapper.GetCurrentDateTime();

            var noteToPersist = new Note
            {
                Id                   = _guidWrapper.GetNew(),
                Text                 = note.Text,
                CreationDate         = dateTime,
                LastModificationDate = dateTime
            };

            return(await _repository.CreateAsync(noteToPersist));
        }