public DiagnosticsRegistry() { Applies.ToAssemblyContainingType <DiagnosticsRegistry>(); Actions.IncludeTypes(x => x.HasAttribute <FubuDiagnosticsAttribute>()).IncludeType <GraphQuery>().IncludeType <ScriptWriter>(); Routes.UrlPolicy <DiagnosticUrlPolicy>(); Services(x => { x.ReplaceService <IObjectResolver, RecordingObjectResolver>(); x.ReplaceService <IDebugReport, DebugReport>(); x.ReplaceService <IRequestData, RecordingRequestData>(); x.ReplaceService <IFubuRequest, RecordingFubuRequest>(); x.ReplaceService <IDebugDetector, DebugDetector>(); x.ReplaceService <IAuthorizationPolicyExecutor, RecordingAuthorizationPolicyExecutor>(); x.ReplaceService <IOutputWriter, RecordingOutputWriter>(); }); }
public FUBUPROJECTSHORTNAMERegistry() { IncludeDiagnostics(true); Applies .ToThisAssembly(); Actions .IncludeClassesSuffixedWithController(); Routes .IgnoreControllerNamespaceEntirely(); Import <SparkEngine>(); Views .TryToAttachWithDefaultConventions(); }
public BasicFubuStructureMapRegistry(bool enableDiagnostics, string controllerAssemblyName) { IncludeDiagnostics(enableDiagnostics); Applies.ToAssembly(controllerAssemblyName); Actions .IncludeTypesNamed(x => x.EndsWith("Controller")); Routes .IgnoreControllerNamespaceEntirely(); Views.TryToAttach(x => { x.by_ViewModel_and_Namespace_and_MethodName(); x.by_ViewModel_and_Namespace(); x.by_ViewModel(); }); }
public void Add_ShouldAddApplyInfo() { // Arrange var mockedEfRepository = new Mock <IEfRepository <Applies> >(); var mockedSaveContext = new Mock <ISaveContext>(); var apply = new Applies(); mockedEfRepository.Setup(x => x.Update(apply)); mockedSaveContext.Setup(x => x.Commit()); var service = new AppliesService(mockedEfRepository.Object, mockedSaveContext.Object); // Act service.Add(apply); // Assert mockedEfRepository.Verify(x => x.Add(apply), Times.Once); mockedSaveContext.Verify(x => x.Commit(), Times.Once); }
public HelloSparkRegistry() { IncludeDiagnostics(true); Applies .ToThisAssembly(); Actions .IncludeClassesSuffixedWithController(); ApplyHandlerConventions(); Routes .HomeIs <AirRequest>() .IgnoreControllerNamespaceEntirely() .IgnoreMethodSuffix("Command") .IgnoreMethodSuffix("Query") .ConstrainToHttpMethod(action => action.Method.Name.EndsWith("Command"), "POST") .ConstrainToHttpMethod(action => action.Method.Name.StartsWith("Query"), "GET"); Policies.Add <AntiForgeryPolicy>(); this.UseSpark(); Views .TryToAttachWithDefaultConventions() .TryToAttachViewsInPackages(); HtmlConvention <SampleHtmlConventions>(); Services(s => { s.FillType <IExceptionHandler, AsyncExceptionHandler>(); s.ReplaceService <IUrlTemplatePattern, JQueryUrlTemplate>(); }); this.Extensions() .For <AirViewModel>("extension-placeholder", x => "<p>Rendered from content extension.</p>"); }
public HelloSparkRegistry() { IncludeDiagnostics(true); Applies .ToThisAssembly(); Actions .IncludeClassesSuffixedWithController(); this.Spark(spark => { spark .Settings .AddViewFolder("/Features/"); spark .Policies .Add <HelloSparkJavaScriptViewPolicy>() .Add <HelloSparkPolicy>(); spark .Output .ToJavaScriptWhen(call => call.HasOutput && call.OutputType().Equals(typeof(JavaScriptResponse))); }); //this.Validation<ValidationRegistry>(validation => validation // .Failures // .IfModelTypeIs<CreateProductInput>() // .TransferTo<CreateProductRequest>()); Routes .UrlPolicy <HelloSparkUrlPolicy>() .HomeIs <AirController>(c => c.TakeABreath()); Output .ToJson .WhenTheOutputModelIs <JsonResponse>(); }
public ChocolateyRegistry() { IncludeDiagnostics(true); Applies.ToThisAssembly(); Actions.IncludeTypesNamed(x => x.EndsWith("Action")); Routes .IgnoreNamespaceText("Chocolatey.Web.Actions") .IgnoreControllerNamesEntirely() .IgnoreClassSuffix("Action") .IgnoreMethodsNamed("Execute") .IgnoreMethodsNamed("Get").ConstrainToHttpMethod(action => action.Method.Name.Equals("Get"), "GET") .IgnoreMethodsNamed("Post").ConstrainToHttpMethod(action => action.Method.Name.Equals("Post"), "POST") //.IgnoreMethodsNamed("Delete").ConstrainToHttpMethod(action => action.Method.Name.Equals("Delete"), "DELETE") //.IgnoreMethodsNamed("Put").ConstrainToHttpMethod(action => action.Method.Name.Equals("Put"), "PUT") ; Routes.HomeIs <HomeAction>(x => x.Get(null)); Views.TryToAttachWithDefaultConventions(); }
public CodeCampOverflowFubuRegistry() { IncludeDiagnostics(true); Applies.ToThisAssembly(); Actions.IncludeClassesSuffixedWithController(); Routes .HomeIs <HomeController>(x => x.IndexQuery()) .IgnoreControllerNamespaceEntirely() .IgnoreMethodsNamed("Index") .IgnoreMethodSuffix("Command") .IgnoreMethodSuffix("Query") .ConstrainToHttpMethod(action => action.Method.Name.EndsWith("Command"), "POST") .ConstrainToHttpMethod(action => action.Method.Name.EndsWith("Query"), "GET"); Views.TryToAttachWithDefaultConventions(); ApplyConvention <ValidationConvention>(); ApplyConvention <PersistenceConvention>(); HtmlConvention <CodeCampOverflowHtmlConventions>(); }
public TestPackage4Registry() { Applies.ToThisAssembly(); Actions.IncludeClassesSuffixedWithController(); }
public CoreRegistry() { Applies.ToThisAssembly(); //IncludeDiagnostics(true); Actions.IncludeTypesNamed(x => x.EndsWith("Handler")); Routes .ConstrainToHttpMethod(x => x.Method.Name.EndsWith("Query"), "GET") .ConstrainToHttpMethod(x => x.Method.Name.EndsWith("Command"), "POST"); Routes .IgnoreNamespaceText(typeof(CoreRegistry).Namespace) .IgnoreNamespaceText("Handlers") .IgnoreMethodsNamed("Query") .IgnoreMethodsNamed("Command") .IgnoreClassSuffix("Handler"); Routes.HomeIs <HomeHandler>(x => x.Query(new HomeQueryModel())); Views.TryToAttachWithDefaultConventions() .RegisterActionLessViews(t => t.ViewModelType == typeof(Notification)); this.UseSpark(); Policies.ConditionallyWrapBehaviorChainsWith <HandlerAssetConvention>(x => x.HandlerType.Namespace.Contains("Products")); Policies.Add(new ProductNotFoundPolicy <EditHandler>(h => h.Query(null))); Policies.Add(new ProductNotFoundPolicy <DeleteHandler>(h => h.Query(null))); Output.ToJson.WhenCallMatches(x => x.Method.Name.Equals("Data")); Import <BasicLocalizationSupport>(x => { x.LocalizationStorageIs <InMemoryLocalizationStorage>(); x.LoadLocalizationWith <LocalizationActivator>(); x.DefaultCulture = Thread.CurrentThread.CurrentUICulture; }); var validationRulesHtmlConventionActivator = ObjectDef.ForType <ValidationHtmlConvention>(); var validationRulesHtmlConvention = new HtmlConventionRegistry(); validationRulesHtmlConventionActivator.DependencyByValue(validationRulesHtmlConvention); Services(cfg => { cfg.SetServiceIfNone <IProductService, InMemoryProductService>(); cfg.SetServiceIfNone(Mapper.Engine); cfg.SetServiceIfNone(Mapper.Configuration); cfg.SetServiceIfNone <ILocaleCacheFactory, LocaleCacheFactory>(); cfg.SetServiceIfNone <IValidationDescriptorProvider>(new ValidationDescriptorProvider()); cfg.AddService <IHtmlValidationConvention, LocalizedNameConvention>(); cfg.AddService <IHtmlValidationConvention, RequiredHtmlValidationConvention>(); cfg.AddService <IHtmlValidationConvention, GreaterOrEqualToZeroHtmlValidationConvention>(); cfg.AddService <IHtmlValidationConvention, MaximumLengthHtmlValidationConvention>(); cfg.AddService <IFieldValidationSource, AddProductModelValidationSource>(); cfg.AddService <IActivator, AutoMapperActivator>(); cfg.AddService <IActivator, ValidationDescriptorProviderFiller>(); cfg.AddService(typeof(IActivator), validationRulesHtmlConventionActivator); }); HtmlConvention(htmlConventions); HtmlConvention(validationRulesHtmlConvention); this.Validation(validation => { validation.Actions.Include(call => call.HasInput && call.Method.Name.Equals("Command")); validation.Failures .IfModelIs <EditProductCommandModel>().TransferBy <ValidationDescriptor>(); }); Models.BindPropertiesWith <OriginalModelBinder>(); }
public ActionResult About() { Applies model = new Applies(); return(View(model)); }
public override ErrorList Validate() { var result = new ErrorList(); result.AddRange(base.Validate()); if (Name != null) { result.AddRange(Name.Validate()); } if (Value != null) { result.AddRange(Value.Validate()); } if (Interpretation != null) { result.AddRange(Interpretation.Validate()); } if (CommentsElement != null) { result.AddRange(CommentsElement.Validate()); } if (Applies != null) { result.AddRange(Applies.Validate()); } if (IssuedElement != null) { result.AddRange(IssuedElement.Validate()); } if (StatusElement != null) { result.AddRange(StatusElement.Validate()); } if (ReliabilityElement != null) { result.AddRange(ReliabilityElement.Validate()); } if (BodySite != null) { result.AddRange(BodySite.Validate()); } if (Method != null) { result.AddRange(Method.Validate()); } if (Identifier != null) { result.AddRange(Identifier.Validate()); } if (Subject != null) { result.AddRange(Subject.Validate()); } if (Performer != null) { result.AddRange(Performer.Validate()); } if (ReferenceRange != null) { ReferenceRange.ForEach(elem => result.AddRange(elem.Validate())); } if (Component != null) { Component.ForEach(elem => result.AddRange(elem.Validate())); } return(result); }
public override IDeepCopyable CopyTo(IDeepCopyable other) { var dest = other as Observation; if (dest != null) { base.CopyTo(dest); if (Code != null) { dest.Code = (Hl7.Fhir.Model.CodeableConcept)Code.DeepCopy(); } if (Value != null) { dest.Value = (Hl7.Fhir.Model.Element)Value.DeepCopy(); } if (DataAbsentReason != null) { dest.DataAbsentReason = (Hl7.Fhir.Model.CodeableConcept)DataAbsentReason.DeepCopy(); } if (Interpretation != null) { dest.Interpretation = (Hl7.Fhir.Model.CodeableConcept)Interpretation.DeepCopy(); } if (CommentsElement != null) { dest.CommentsElement = (Hl7.Fhir.Model.FhirString)CommentsElement.DeepCopy(); } if (Applies != null) { dest.Applies = (Hl7.Fhir.Model.Element)Applies.DeepCopy(); } if (IssuedElement != null) { dest.IssuedElement = (Hl7.Fhir.Model.Instant)IssuedElement.DeepCopy(); } if (StatusElement != null) { dest.StatusElement = (Code <Hl7.Fhir.Model.Observation.ObservationStatus>)StatusElement.DeepCopy(); } if (ReliabilityElement != null) { dest.ReliabilityElement = (Code <Hl7.Fhir.Model.Observation.ObservationReliability>)ReliabilityElement.DeepCopy(); } if (BodySite != null) { dest.BodySite = (Hl7.Fhir.Model.Element)BodySite.DeepCopy(); } if (Method != null) { dest.Method = (Hl7.Fhir.Model.CodeableConcept)Method.DeepCopy(); } if (Identifier != null) { dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy()); } if (Subject != null) { dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy(); } if (Specimen != null) { dest.Specimen = (Hl7.Fhir.Model.ResourceReference)Specimen.DeepCopy(); } if (Performer != null) { dest.Performer = new List <Hl7.Fhir.Model.ResourceReference>(Performer.DeepCopy()); } if (Device != null) { dest.Device = (Hl7.Fhir.Model.ResourceReference)Device.DeepCopy(); } if (Encounter != null) { dest.Encounter = (Hl7.Fhir.Model.ResourceReference)Encounter.DeepCopy(); } if (ReferenceRange != null) { dest.ReferenceRange = new List <Hl7.Fhir.Model.Observation.ObservationReferenceRangeComponent>(ReferenceRange.DeepCopy()); } if (Related != null) { dest.Related = new List <Hl7.Fhir.Model.Observation.ObservationRelatedComponent>(Related.DeepCopy()); } return(dest); } else { throw new ArgumentException("Can only copy to an object of the same type", "other"); } }
public void Delete(Applies apply) { this.applyRepo.Delete(apply); this.context.Commit(); }
public void Update(Applies apply) { this.applyRepo.Update(apply); this.context.Commit(); }
public void Add(Applies apply) { this.applyRepo.Add(apply); this.context.Commit(); }