Ejemplo n.º 1
0
        public void ForCreate_Sets_ModifiedByOn()
        {
            var modifier = new SolutionsModifier(_context.Object, _contacts.Object);
            var soln     = Creator.GetSolution();

            soln.ModifiedOn = new DateTime(2006, 2, 20);
            _context.Setup(x => x.HttpContext).Returns(Creator.GetContext());
            var contact = Creator.GetContact();

            _contacts.Setup(x => x.ByEmail(It.IsAny <string>())).Returns(contact);

            modifier.ForCreate(soln);

            soln.ModifiedOn.Should().BeCloseTo(DateTime.UtcNow);
        }
Ejemplo n.º 2
0
        public void ForCreate_Sets_ModifiedById()
        {
            var modifier = new SolutionsModifier(_context.Object, _contacts.Object);
            var soln     = Creator.GetSolution();

            _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);

            modifier.ForCreate(soln);

            soln.ModifiedById.Should().Be(contactId);
        }