public void GetCollaterals_Success() { // Act var response = controller.GetCollaterals(defaultContactId, defaultcontactTypeId, false).Result; var count = response.DataItems.Count; // Assert Assert.IsTrue(count > 0, "Atleast one Collateral must exists."); }
public void GetCollaterals_Success() { // Arrange PrepareResponse(colleteralDataForSuccess); Response <CollateralModel> collateralResponse = new Response <CollateralModel>(); collateralResponse.DataItems = collaterals.Where(contact => contact.ParentContactID == defaultContactId && contact.ContactTypeID == defaultContactTypeId).ToList(); mock.Setup(r => r.GetCollaterals(It.IsAny <long>(), It.IsAny <int>(), false)) .Returns(collateralResponse); //Act var getCollateralResult = collateralController.GetCollaterals(defaultContactId, defaultContactTypeId, false); var response = getCollateralResult as HttpResult <Response <CollateralModel> >; //Assert Assert.IsNotNull(response, "Response can't be null"); Assert.IsNotNull(response.Value.DataItems, "Data items can't be null"); Assert.IsTrue(response.Value.DataItems.Count() > 0, "Atleast one Collateral must exists."); }