public void CreateBasket()
        {
            // Given there are two pets available for sale
            _blackie = new Pet {
                Name = "Blackie"
            };
            _sandy = new Pet {
                Name = "Sandy"
            };
            _petRepository = new Mock <ILookAfterPets>();
            _petRepository.SetupGet(p => p.UnsoldPets).Returns(new ObservableCollection <Pet> {
                _blackie, _sandy
            });

            // Given we can respond to accessories being selected and deselected
            _accessoryRepository = new Mock <ILookAfterAccessories>();
            _accessoryRepository.Setup(ar => ar.OnAccessorySelected(It.IsAny <EventHandler <AccessoryEventArgs> >()))
            .Callback <EventHandler <AccessoryEventArgs> >(eh => _accessoriesSelected += eh);
            _accessoryRepository.Setup(ar => ar.OnAccessoryUnselected(It.IsAny <EventHandler <AccessoryEventArgs> >()))
            .Callback <EventHandler <AccessoryEventArgs> >(eh => _accessoriesUnselected += eh);

            // Given we can respond to messages
            _messenger = new Mock <IHandleMessages>();

            // Given we can publish events
            _events = new StubEventAggregator();

            // Given a basket model
            _basketModel = new BasketViewModel(_petRepository.Object, _accessoryRepository.Object, _messenger.Object, _events);

            // Given we're listening to the properties that change
            _propertiesChanged            = new List <string>();
            _basketModel.PropertyChanged += (o, e) => _propertiesChanged.Add(e.PropertyName);
        }
        public void ShouldRaiseWarningOnUnexpectedKindInReferenceInEvent()
        {
            var ev      = MockRepository.GenerateMock <WarningEvent>();
            var model   = new DocumentModel(RealParser, StubEventAggregator);
            var members = new IDocumentationMember[] { Event <Second>(@"<member name=""E:Example.Second.AnEvent""><summary><see cref=""G:Whats-a-g"" /></summary></member>", "AnEvent") };

            StubEventAggregator.Stub(x => x.GetEvent <WarningEvent>())
            .Return(ev);

            model.Create(members);

            ev.AssertWasCalled(x => x.Publish("Unsupported documentation member found: 'G:Whats-a-g'"));
        }
Beispiel #3
0
        public void set_assemblies_should_publish_event_if_bad_file_found()
        {
            var ev     = MockRepository.GenerateMock <BadFileEvent>();
            var parser = MockRepository.GenerateMock <IAssemblyXmlParser>();

            StubEventAggregator.Stub(x => x.GetEvent <BadFileEvent>())
            .Return(ev);

            var generator = new DocumentationGenerator(new AssemblyLoader(), StubXmlLoader, parser, StubWriter, StubResourceManager, StubEventAggregator);

            generator.SetAssemblies(new[] { "docu.pdb" });

            ev.AssertWasCalled(x => x.Publish("docu.pdb"));
        }