public void All_and_only_Repositories_have_Repository_suffix() { var allRepositorys = GetPublicClassesFromApplicationAssembly(c => c.Name.EndsWith("Repository")); var registeredRepositorys = InstallerTestHelper.GetImplementationTypesFor(typeof(IRepository), containerWithRepositories); Assert.AreEqual(allRepositorys, registeredRepositorys); }
public void All_and_only_controllers_live_in_Controllers_namespace() { var allControllers = GetPublicClassesFromApplicationAssembly(c => c.Namespace.Contains("Controllers")); var registeredControllers = InstallerTestHelper.GetImplementationTypesFor(typeof(IController), containerWithControllers); Assert.AreEqual(allControllers, registeredControllers); }
public void All_and_only_controllers_have_Controllers_suffix() { var allControllers = GetPublicClassesFromApplicationAssembly(c => c.Name.EndsWith("Controller")); var registeredControllers = InstallerTestHelper.GetImplementationTypesFor(typeof(IController), containerWithControllers); Assert.AreEqual(allControllers, registeredControllers); }
public void AllControllersAreRegistered() { // Is<TType> is a helper extension method from Windsor // which behaves like 'is' keyword in C# but at a Type, not instance level System.Type[] allControllers = InstallerTestHelper.GetPublicClassesFromApplicationAssembly(c => c.Is <IController>()); System.Type[] registeredControllers = InstallerTestHelper.GetImplementationTypesFor(typeof(IController), container); Assert.That(registeredControllers, Is.EqualTo(allControllers)); }
public void All_Repositories_are_registered() { // Is<TType> is an helper, extension method from Windsor // which behaves like 'is' keyword in C# but at a Type, not instance level var allRepositorys = GetPublicClassesFromApplicationAssembly(c => c.Is <IRepository>()); var registeredRepositorys = InstallerTestHelper.GetImplementationTypesFor(typeof(IRepository), containerWithRepositories); Assert.AreEqual(allRepositorys, registeredRepositorys); }
public void AllAndOnlyControllersHaveControllerSuffix() { System.Type[] allControllers = InstallerTestHelper.GetPublicClassesFromApplicationAssembly(c => c.Name.EndsWith("Controller")); System.Type[] registeredControllers = InstallerTestHelper.GetImplementationTypesFor(typeof(IController), container); System.Type[] registeredApiControllers = InstallerTestHelper.GetImplementationTypesFor(typeof(IHttpController), container); System.Type[] actual = registeredControllers.Concat(registeredApiControllers) .OrderBy(x => x.Name) .ToArray(); Assert.That(actual, Is.EqualTo(allControllers)); }