public void GetLiveOfferAttributesFailureTest() { var IOffersManager = new Mock<IOffersManager>(); OkNegotiatedContentResult<OfferAttributesResponse> response; OfferAttributesDataObject OfferAttributesData = new OfferAttributesDataObject() { Errors = new List<ErrorObject>() { new ErrorObject(ErrorKey.ERR_INTERNAL_FATAL) }, Attributes = null }; IOffersManager.Setup(i => i.GetOfferAttributes(It.IsAny<HttpRequestMessage>(), It.IsAny<string>(), new Guid().ToString())).Returns(OfferAttributesData); controller = new InitController("Liveoffers").initLiveOffersController(IOffersManager.Object); response = controller.GetAttributes(new Guid().ToString()) as OkNegotiatedContentResult<OfferAttributesResponse>; Assert.Null(response.Content.Data.Attributes); Assert.NotNull(response.Content.Data.Errors); Assert.True(response.Content.Data.Errors.Exists(i => i.Code == 3000)); }
public void GetLiveOfferAttributesTest() { var IOffersManager = new Mock<IOffersManager>(); OkNegotiatedContentResult<OfferAttributesResponse> response; OfferAttributesDataObject OfferAttributesData = new OfferAttributesDataObject() { Errors = new List<ErrorObject>(), Attributes = new List<OfferAttributeApiObject>() { new OfferAttributeApiObject() } }; IOffersManager.Setup(i => i.GetOfferAttributes(It.IsAny<HttpRequestMessage>(), It.IsAny<string>(), new Guid().ToString())).Returns(OfferAttributesData); controller = new InitController("Liveoffers").initLiveOffersController(IOffersManager.Object); response = controller.GetAttributes(new Guid().ToString()) as OkNegotiatedContentResult<OfferAttributesResponse>; Assert.NotNull(response.Content.Data.Attributes); Assert.NotEmpty(response.Content.Data.Attributes); Assert.Null(response.Content.Data.Errors); }