Ejemplo n.º 1
0
        // ReSharper disable once InconsistentNaming
        public async Task Controller_Can_GET_fake_detail_ticker_info_for_an_investor_with_verification_of_revenue_and_positions() 
        {
            // Arrange - default displayType = detail.
            _ctrl = new AssetController(_mockRepo.Object, _mockIdentitySvc.Object, _mockRepoInvestor.Object, _mockRepoAssetClass.Object, _mockRepoProfile.Object, _mockRepoAcctType.Object, _mockRepoPosition.Object, _mockRepoIncome.Object) {
                Request = new HttpRequestMessage { RequestUri = new Uri("http://localhost/PIMS.Web.Api/api/Asset/IBM") },
                Configuration = new HttpConfiguration()
            };

            // Act 
            var assetListing = await _ctrl.GetByTicker("IBM") as OkNegotiatedContentResult<IQueryable<Asset>>;


            // Assert
            Assert.IsNotNull(assetListing);
            Assert.That(assetListing.Content.Count(), Is.EqualTo(1));
            Assert.That(assetListing.Content.First().Positions.Count, Is.GreaterThanOrEqualTo(2));
            Assert.That(assetListing.Content.First().Revenue.Count, Is.GreaterThanOrEqualTo(3));
            Assert.IsTrue(assetListing.Content.ElementAt(0).Investor.LastName == _mockIdentitySvc.Object.CurrentUser);
            
        }