Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
.nuget
Chat.Client-EventSubscription
Chat.Client-Handler
Chat.Client-Subscribe
Chat.Library
Chat.Moderator.Tests
Chat.Moderator
packages
README.md
nvents-samples.sln

README.md

Chat samples

This is a sample solution for showing different ways of using nvents.

Chat.Client-Subscribe

Demonstrates the easiest way to subscribe to events using Events.Subscribe<MyEvent>(e => ..) see Chat.Client-Subscribe/MainWindow.xaml.cs.

Chat.Client-Handler

Demonstrates the usage of event handlers by implementing IHandler<TEvent>. Two handlers are used Chat.Client-Handler/Handlers/MessageSentHandler.cs and Chat.Client-Handler/Handlers/UserKickedHandler.cs and they are registered by calling Events.RegisterHandler(handler) in Chat.Client-Handler/MainWindow.xaml.cs.

Chat.Client-EventSubscription

Demonstrates the usage of standard .NET event registration by creating a new EventSubscription<MyEvent> and attaching to it's Published event see Chat.Client-EventSubscription/MainWindow.xaml.cs.

Chat.Moderator

A more complete example using event handlers and the IPublisher interface. Also demonstrating IoC (Ninject) and MVVM (Caliburn.Micro) with nvents. The event handler Chat.Moderator/Handlers/MessageSentHandler.cs is registered in Chat.Moderator/NventsModule.cs which also binds the IPublisher interface to the default nvents service. IPublisher is used in Chat.Moderator/ViewModels/ShellViewModel.cs to publish UserKicked events.

Chat.Moderator.Tests

Test that the event is published by stubbing, mocking or faking IPublisher and asserting that Publish was called as shown in Chat.Moderator.Tests/ViewModels/ShellViewModelTests.cs. Test that the event is subscribed to by stubbing, mocking or faking Events.Service and asserting that Subscribe was called as shown in Chat.Moderator.Tests/NventsModuleTests.cs.

Chat.Library

Library containing UserKicked and MessageSent events and the User class.


nvents - an open source library for strongly typed publishing/subscribing of events over the network.