public void ForUpdate_DefaultOriginalDate_SetsOriginalDate_ToUtcNow() { _context.Setup(x => x.HttpContext).Returns(Creator.GetContext()); _contacts.Setup(x => x.ByEmail(It.IsAny <string>())).Returns(Creator.GetContact()); var modifier = new DummyReviewsBaseModifier(_context.Object, _contacts.Object); var review = Creator.GetReviewsBase(originalDate: default(DateTime)); modifier.ForUpdate(review); review.OriginalDate.Should().BeCloseTo(DateTime.UtcNow); }
public void ForCreate_SetsCreatedOn_ToUtcNow() { _context.Setup(x => x.HttpContext).Returns(Creator.GetContext()); _contacts.Setup(x => x.ByEmail(It.IsAny <string>())).Returns(Creator.GetContact()); var modifier = new DummyReviewsBaseModifier(_context.Object, _contacts.Object); var review = Creator.GetReviewsBase(createdOn: DateTime.MinValue); modifier.ForCreate(review); review.CreatedOn.Should().BeCloseTo(DateTime.UtcNow); }
public void ForUpdate_OriginalDate_DoesNotSet_OriginalDate() { _context.Setup(x => x.HttpContext).Returns(Creator.GetContext()); _contacts.Setup(x => x.ByEmail(It.IsAny <string>())).Returns(Creator.GetContact()); var modifier = new DummyReviewsBaseModifier(_context.Object, _contacts.Object); var originalDate = new DateTime(2006, 2, 20, 6, 3, 0); var review = Creator.GetReviewsBase(originalDate: originalDate); modifier.ForUpdate(review); review.OriginalDate.Should().BeCloseTo(originalDate); }
public void ForCreate_SetsCreatedById() { _context.Setup(x => x.HttpContext).Returns(Creator.GetContext()); var contactId = Guid.NewGuid().ToString(); var contact = Creator.GetContact(id: contactId); _contacts.Setup(x => x.ByEmail(It.IsAny <string>())).Returns(contact); var modifier = new DummyReviewsBaseModifier(_context.Object, _contacts.Object); var review = Creator.GetReviewsBase(originalDate: DateTime.MinValue); modifier.ForCreate(review); review.CreatedById.Should().Be(contactId); }