BinaryStudio.ClientManager.WebUi.Tests.Controllers.ClientsControllerTests.ShouldNot_ReturnNullAndShouldCallMethodGetOfIRepository_WhenRequestedDetails C# (CSharp) Method

ShouldNot_ReturnNullAndShouldCallMethodGetOfIRepository_WhenRequestedDetails() private method

        public void ShouldNot_ReturnNullAndShouldCallMethodGetOfIRepository_WhenRequestedDetails()
        {
            // arrange
            var returnedClient = new Person
            {
                Id = 1,
                Role=PersonRole.Client
            };
            var repository = Substitute.For<IRepository>();
            repository.Get<Person>(1).Returns(returnedClient);
            repository.Query<Inquiry>().Returns(new[] {new Inquiry {Client = returnedClient}}.AsQueryable());
            var clientController = new ClientsController(repository);

            // act
            var viewModel = clientController.Details(1).Model as ClientDetailsViewModel;

            // assert
            viewModel.Should().NotBeNull();
            repository.Received().Get<Person>(1);
        }