public async Task ShouldGetDetailsPage()
        {
            //Arrange
            var guid             = Guid.NewGuid();
            var mock             = new Mock <IFundManagerRepository>();
            var fundManagerModel = new FundManager();

            mock.Setup(m => m.Get(guid))
            .Returns(Task.FromResult(fundManagerModel))
            .Verifiable();
            var mockFundRepo = new Mock <IFundRepository>();
            IEnumerable <Fund> emptyFunds = new List <Fund>();

            mockFundRepo.Setup(m => m.GetFunds(new Guid()))
            .Returns(Task.FromResult(emptyFunds))
            .Verifiable();
            var controller = new FundManagerController(mock.Object, mockFundRepo.Object);

            var expected = new FundManager {
                Funds = new List <Fund>()
            }.ToExpectedObject();

            //Act
            var actual = await controller.Details(guid);

            //Assert
            Assert.That(actual, Is.TypeOf <ViewResult>());
            Assert.That(((ViewResult)actual).Model, Is.EqualTo(expected));
        }
示例#2
0
        public async void ShouldGetDetailsPage()
        {
            var guid             = Guid.NewGuid();
            var mock             = new Mock <IFundManagerModelRepository>();
            var fundManagerModel = new FundManagerModel();

            mock.Setup(m => m.Get(guid)).Returns(Task.FromResult(fundManagerModel));
            var controller = new FundManagerController(mock.Object);

            var result = await controller.Details(guid);

            Assert.That(result, Is.TypeOf <ViewResult>());
            mock.Verify();
            Assert.That(((ViewResult)result).Model, Is.EqualTo(fundManagerModel));
        }