BinaryStudio.ClientManager.WebUi.Controllers.ClientsController.MailingHistory C# (CSharp) Метод

MailingHistory() публичный Метод

public MailingHistory ( int id ) : System.Web.Mvc.ViewResult
id int
Результат System.Web.Mvc.ViewResult
        public ViewResult MailingHistory(int id)
        {
            return View(repository.Query<MailMessage>(x => x.Sender, x => x.Receivers)
                .Where(x => x.Sender.Id == id || x.Receivers.Any(y => y.Id == id))
                .OrderBy(x => x.Date)
                .ToList());
        }

Usage Example

Пример #1
0
        public void Should_ReturnSpecifiedPersonWithRelatedMailSortedByDate_WhenRequested()
        {
            // arrange
            var person = Builder<Person>.
                CreateNew().
                With(x => x.Id = 7777).
                With(x => x.RelatedMails =
                    Builder<MailMessage>.
                    CreateListOfSize(10).
                    All().
                    With(d => d.Date = new RandomGenerator().DateTime()).
                    Build()).
                Build();

            var repository = Substitute.For<IRepository>();
            repository.Get<Person>(7777).Returns(person);

            var clientController = new ClientsController(repository);

            // act
            var viewResult = clientController.MailingHistory(7777).Model as Person;

            // assert
            for (int i = 1; i < viewResult.RelatedMails.Count; i++)
                Assert.That(viewResult.RelatedMails[i].Date >=
                    viewResult.RelatedMails[i - 1].Date);
        }
All Usage Examples Of BinaryStudio.ClientManager.WebUi.Controllers.ClientsController::MailingHistory