Example #1
0
 public void GetAssets_BadRepoTest()
 {
     Mock<IAssetRepository> mockAssetRepo = new Mock<IAssetRepository>();
     mockAssetRepo.Setup(x => x.Find()).Throws(new RepositoryException());
     IAssetViewService assetService = new AssetViewService(mockAssetRepo.Object);
     assetService.GetAssets();
 }
Example #2
0
        public void GetAssets_Test()
        {
            IAssetViewService assetService = new AssetViewService(_mockAssetRepository.Object);
            IList<Asset> assetDtos = assetService.GetAssets();

            Assert.IsNotNull(assetDtos);
            Assert.IsTrue(assetDtos.Count == 2);
        }
Example #3
0
        public void GetAsset_Test()
        {
            IAssetViewService assetService = new AssetViewService(_mockAssetRepository.Object);
            Asset assetDto = assetService.GetAsset(assetAId);

            Assert.IsNotNull(assetDto);
            Assert.AreEqual(assetA.Identifier, assetDto.Identifier, "The id does not match the expected value.");
            Assert.AreEqual(assetA.Name, assetDto.Name, "The name does not match the expected value.");
            Assert.AreEqual(assetA.Content.Data, assetDto.Content.Data, "The data does not match the expected value.");
        }
Example #4
0
 public void GetAsset_BadRepoTest()
 {
     IAssetViewService assetService = new AssetViewService(_mockAssetRepository.Object);
     assetService.GetAsset(assetBadId);
 }