public async Task GetLayersAsync_Return_OK_Layers() { // arrange var layer = new AssetConditionLayer { Id = "1", Description = "description", Priority = 10, ClientsCanCashInViaBankCards = true, SwiftDepositEnabled = false }; _assetConditionServiceMock.Setup(o => o.GetLayersAsync()) .Returns(Task.FromResult((IEnumerable <IAssetConditionLayer>) new List <IAssetConditionLayer> { layer })); // act IActionResult actionResult = await _controller.GetLayersAsync(); var result = ((IEnumerable <AssetConditionLayerModel>)((OkObjectResult)actionResult).Value).First(); // assert Assert.IsTrue(AreEqual(result, layer)); }
public async Task GetLayerByIdAsync_Return_OK_Layer() { // arrange const string layerId = "layer"; var layer = new AssetConditionLayer { Id = "1", Description = "description", Priority = 10, ClientsCanCashInViaBankCards = true, SwiftDepositEnabled = false, AssetConditions = new List <IAssetCondition> { new AssetCondition { Asset = "asset", Regulation = "regulation", AvailableToClient = true } }, AssetDefaultCondition = new AssetDefaultCondition { Regulation = "regulation", AvailableToClient = true } }; _assetConditionServiceMock.Setup(o => o.GetLayerAsync(It.IsAny <string>())) .Returns(Task.FromResult((IAssetConditionLayer)layer)); // act IActionResult actionResult = await _controller.GetLayerByIdAsync(layerId); var result = (AssetConditionLayerModel)((OkObjectResult)actionResult).Value; // assert Assert.IsTrue(AreEqual(result, layer)); }