public void build_object_def()
 {
     var node = new WriteWithFormatter(typeof (Address), typeof (SomeFormatter));
     var objectDef = node.As<IContainerModel>().ToObjectDef(DiagnosticLevel.None);
     objectDef.FindDependencyDefinitionFor<IMediaWriter<Address>>()
         .Type.ShouldEqual(typeof (FormatterWriter<Address, SomeFormatter>));
 }
 public bool Equals(WriteWithFormatter other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(Equals(other._resourceType, _resourceType) && Equals(other._formatterType, _formatterType));
 }
Beispiel #3
0
        public WriteWithFormatter AddFormatter <T>() where T : IFormatter
        {
            var        formatter = new WriteWithFormatter(_resourceType, typeof(T));
            WriterNode existing  = Writers.FirstOrDefault(x => x.Equals(formatter));

            if (existing != null)
            {
                return(existing as WriteWithFormatter);
            }


            Writers.AddToEnd(formatter);

            return(formatter);
        }
Beispiel #4
0
 public bool Equals(WriteWithFormatter other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return Equals(other._resourceType, _resourceType) && Equals(other._formatterType, _formatterType);
 }
        public void finds_mime_types_off_of_the_formatter_type()
        {
            var node = new WriteWithFormatter(typeof (Address), typeof (SomeFormatter));

            node.Mimetypes.ShouldHaveTheSameElementsAs("text/html", "other/mimetype");
        }