public void Ctr_ControllerActionParameters_SetToOptionalIfDefaultValueSpecified() { var container = new Container(config => { config.AddType(typeof(ControllerBase), typeof(TestController3)); }); var reader = new ControllerReader(container, new IControllerActionInterceptor[0]); Assert.True(reader.Definitions.First(a => a.ActionName.Equals("DefaultTest")).Parameters.First.Value.Optional); }
public void Ctr_ControllerActionParameters_WithCorrectName() { var container = new Container(config => { config.AddType(typeof(ControllerBase), typeof(TestController3)); }); var reader = new ControllerReader(container, new IControllerActionInterceptor[0]); Assert.Equal("id", reader.Definitions.First(a => a.ActionName.Equals("ParamTest")).Parameters.First.Value.Name); }
public void Ctr_AddsControllerParameters() { var container = new Container(config => { config.AddType(typeof(ControllerBase), typeof(TestController3)); }); var reader = new ControllerReader(container, new IControllerActionInterceptor[0]); Assert.NotEmpty(reader.Definitions.First(a => a.ActionName.Equals("ParamTest")).Parameters); }
public void Ctr_DoesNotAddController_WhenInterceptorReturnsFalse() { var container = new Container(config => { config.AddType(typeof(ControllerBase), typeof(TestController)); config.AddType(typeof(ControllerBase), typeof(TestController2)); }); var reader = new ControllerReader(container, new[] { new BlankInterceptor { ReturnValue = true }, new BlankInterceptor { ReturnValue = false }, new BlankInterceptor { ReturnValue = true } }); Assert.Equal(0, reader.Definitions.Count()); }
public void Ctr_AddsControllerActions_FromContainerModel() { var container = new Container(config => { config.AddType(typeof(ControllerBase), typeof(TestController)); config.AddType(typeof(ControllerBase), typeof(TestController2)); }); var reader = new ControllerReader(container, new IControllerActionInterceptor[0]); Assert.Equal(2, reader.Definitions.Count()); }
public void Ctr_ControllerActionParameters_SetsDescription_IfDocumentationSpecified() { var container = new Container(config => { config.AddType(typeof(ControllerBase), typeof(TestController3)); }); var reader = new ControllerReader(container, new IControllerActionInterceptor[0]); Assert.NotEmpty(reader.Definitions.First(a => a.ActionName.Equals("SummaryTest")).Parameters.First.Value.Description); }
public void Ctr_ControllerActionParameters_DefaultValueSetToDefaultVAlueIfSpecified() { var container = new Container(config => { config.AddType(typeof(ControllerBase), typeof(TestController3)); }); var reader = new ControllerReader(container, new IControllerActionInterceptor[0]); Assert.Equal("\"" + TestController3.defaultValue + "\"", reader.Definitions.First(a => a.ActionName.Equals("DefaultTest")).Parameters.First.Value.DefaultValue); }
public void Ctr_ControllerAction_SetsDescription_WhenSummaryXMLContainsSummary() { var container = new Container(config => { config.AddType(typeof(ControllerBase), typeof(TestController3)); }); var reader = new ControllerReader(container, new IControllerActionInterceptor[0]); Assert.NotEmpty(reader.Definitions.First(a => a.ActionName.Equals("ActionSummaryTest")).Description); }