public DiffItemDTO MapFrom(DiffItem diffItem)
 {
     _diffItemDTO = new DiffItemDTO {
         Description = diffItem.Description
     };
     try
     {
         this.Visit(diffItem);
         return(_diffItemDTO);
     }
     finally
     {
         _diffItemDTO = null;
     }
 }
示例#2
0
        protected override void Context()
        {
            base.Context();
            _diffItem1 = new PropertyValueDiffItem();
            _diffItem2 = new PropertyValueDiffItem();
            _dto1      = new DiffItemDTO();
            _dto2      = new DiffItemDTO();

            _dto1.PathElements[PathElementId.Name] = new PathElement {
                DisplayName = "A"
            };
            _dto2.PathElements[PathElementId.Name] = new PathElement {
                DisplayName = "B"
            };

            _dto1.PathElements[PathElementId.Molecule] = new PathElement {
                DisplayName = "Mol"
            };
            _dto2.PathElements[PathElementId.Molecule] = new PathElement {
                DisplayName = "Mol2"
            };

            _dto1.PathElements[PathElementId.TopContainer] = new PathElement {
                DisplayName = "A"
            };
            _dto2.PathElements[PathElementId.TopContainer] = new PathElement {
                DisplayName = "A"
            };

            _dto1.PathElements[PathElementId.BottomCompartment] = new PathElement {
                DisplayName = ""
            };
            _dto2.PathElements[PathElementId.BottomCompartment] = new PathElement {
                DisplayName = ""
            };


            _report.Add(_diffItem1);
            _report.Add(_diffItem2);
            A.CallTo(() => _diffItemDTOMapper.MapFrom(_diffItem1)).Returns(_dto1);
            A.CallTo(() => _diffItemDTOMapper.MapFrom(_diffItem2)).Returns(_dto2);

            A.CallTo(() => _view.BindTo(A <IEnumerable <DiffItemDTO> > ._))
            .Invokes(x => _allDiffItemDTO = x.GetArgument <IEnumerable <DiffItemDTO> >(0).ToList());
        }
 protected override void Because()
 {
     _dto = sut.MapFrom(_diffItem);
 }