public TestOffersController initTestOffersController(IOffersManager IOffersManager) { TestOffersController controller = new TestOffersController(IOffersManager); controller.Request = this.request; controller.Request.Properties[HttpPropertyKeys.HttpConfigurationKey] = this.config; controller.Request.Properties["requestId"] = new Guid().ToString(); controller.RequestContext.RouteData = this.routeData; return controller; }
public void GetTestOfferAttributesFailureTest() { 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("Testoffers").initTestOffersController(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 GetTestOfferAttributesTest() { 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("Testoffers").initTestOffersController(IOffersManager.Object); response = controller.GetAttributes(new Guid().ToString()) as OkNegotiatedContentResult<OfferAttributesResponse>; Assert.NotNull(response.Content.Data.Attributes); Assert.Null(response.Content.Data.Errors); }
public void GetTestOfferQuotaExpressionTest() { var IOffersManager = new Mock<IOffersManager>(); OkNegotiatedContentResult<OfferQuotaCellsResponse> response; QuotaExpressionsObjectResponse OfferQuotaCellData = new QuotaExpressionsObjectResponse() { Errors = new List<ErrorObject>(), QuotaCells = "UnitTest" }; IOffersManager.Setup(i => i.GetOfferQuotaExpression(It.IsAny<HttpRequestMessage>(), It.IsAny<string>(), new Guid().ToString())).Returns(OfferQuotaCellData); controller = new InitController("Testoffers").initTestOffersController(IOffersManager.Object); response = controller.GetQuotaExpressions(new Guid().ToString()) as OkNegotiatedContentResult<OfferQuotaCellsResponse>; Assert.NotNull(response.Content.Data.QuotaCells); Assert.Null(response.Content.Data.Errors); }