public void CreatesNoAuditByDefault() { var configuration = new ConfigurationBase(); var target = new SampleAuthenticator(configuration); target.AuditEvent(new Exception("Sample"), MvcTestBase.CreateRequestContext()); var result = target.InternalAudit; Assert.IsNull(result); }
public void ContinuesProcessingWhenUrlIsNull() { var context = MvcTestBase.CreateRequestContext((Uri)null); var target = new SampleAuthenticator(new ConfigurationBase()) { ImageOnly = true, }; target.OnActionExecuting(context); }
public void RedirectsIfExceptionAndActionIsSet() { // todo: still having issues testing this: the newly generated UrlHelper needs "something" to build up a URL var context = MvcTestBase.CreateRequestContext(new Uri("http://exception/Home/Index")); var target = new SampleAuthenticator(new ConfigurationBase()) { InvalidKeyAction = "Index" }; target.OnActionExecuting(context); var redirectResult = context.Result as RedirectResult; Assert.IsNotNull(redirectResult); Assert.AreEqual("/Home/Index/", redirectResult.Url); }
public void DoesNotThrowExceptionsIfLoggerNotCreatable() { var configuration = new ConfigurationBase { Logger = new TypeConfiguration { TypeName = "Sem.Authentication.MvcHelper.A598D4BDB7244B62A4A158201C118882, Sem.Authentication.MvcHelper", } }; var target = new SampleAuthenticator(configuration); target.LogException(new Exception("Sample")); var result = target.InternalLogger; Assert.IsNull(result); }
public void CreatesStandardLogger() { var configuration = new ConfigurationBase { Logger = new TypeConfiguration { TypeName = "Sem.Authentication.AppInfrastructure.DebugLogger, Sem.Authentication", } }; var target = new SampleAuthenticator(configuration); target.LogException(new Exception("Sample")); var result = target.InternalLogger; Assert.IsNotNull(result); }
public void CreatesCallsAuditForSuccessByDefault() { var configuration = new ConfigurationBase { Audit = new TypeConfiguration { TypeName = "Sem.Authentication.AppInfrastructure.DebugAudit, Sem.Authentication", } }; var target = new SampleAuthenticator(configuration); target.AuditEvent(MvcTestBase.CreateRequestContext()); var result = target.InternalAudit; Assert.IsNotNull(result); }
public void ThrowsIfContextHttpContextIsNull() { var target = new SampleAuthenticator(null); target.OnActionExecuting(new ActionExecutingContext()); }