Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
using System.Linq;
using Grand.Web.AdminShared.Controllers;
using Grand.Web.Common.Filters;
using Grand.Web.Common.Security.Authorization;
using Grand.Web.Store.Controllers;
using Microsoft.AspNetCore.Mvc;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Grand.Web.Store.Tests.Controllers;
[TestClass]
public class ProductReviewControllerAttributeTests
{
[TestMethod]
public void IsThinSubclassOfBaseProductReviewController()
{
Assert.IsTrue(typeof(BaseProductReviewController).IsAssignableFrom(typeof(ProductReviewController)));
Assert.AreEqual(typeof(BaseProductReviewController), typeof(ProductReviewController).BaseType);
}
[TestMethod]
public void HasAuthorizeStoreAttribute()
{
var attr = typeof(ProductReviewController).GetCustomAttributes(typeof(AuthorizeStoreAttribute), inherit: false);
Assert.AreEqual(1, attr.Length);
}
[TestMethod]
public void HasAreaStoreAttribute()
{
var attr = typeof(ProductReviewController)
.GetCustomAttributes(typeof(AreaAttribute), inherit: false)
.Cast<AreaAttribute>().Single();
Assert.AreEqual("Store", attr.RouteValue);
}
[TestMethod]
public void HasAutoValidateAntiforgeryTokenAttribute()
{
var attr = typeof(ProductReviewController)
.GetCustomAttributes(typeof(AutoValidateAntiforgeryTokenAttribute), inherit: true);
Assert.AreEqual(1, attr.Length);
}
[TestMethod]
public void HasAuthorizeMenuAttribute()
{
var attr = typeof(ProductReviewController).GetCustomAttributes(typeof(AuthorizeMenuAttribute), inherit: false);
Assert.AreEqual(1, attr.Length);
}
}