public void TestThatDispatchCallsHandleCommunication()
        {
            var communicationRepositoryMock = MockRepository.GenerateMock <ICommunicationRepository>();

            var dispatcherBase = new MyDispatcher <IIdentifiable>(communicationRepositoryMock);

            Assert.That(dispatcherBase, Is.Not.Null);
            Assert.That(dispatcherBase.HandleCommunicationHasBeenCalled, Is.False);

            dispatcherBase.Dispatch(DomainObjectMockBuilder.BuildStakeholderMock(), MockRepository.GenerateMock <IIdentifiable>(), DomainObjectMockBuilder.BuildTranslationInfoMock());
            Assert.That(dispatcherBase.HandleCommunicationHasBeenCalled, Is.True);
        }
        public void TestThatDispatchCallsTranslateWhenDomainObjectIsTranslatable()
        {
            var communicationRepositoryMock = MockRepository.GenerateMock <ICommunicationRepository>();

            var domainObjectMock    = MockRepository.GenerateMock <ITranslatable>();
            var translationInfoMock = DomainObjectMockBuilder.BuildTranslationInfoMock();

            var dispatcherBase = new MyDispatcher <ITranslatable>(communicationRepositoryMock);

            Assert.That(dispatcherBase, Is.Not.Null);

            dispatcherBase.Dispatch(DomainObjectMockBuilder.BuildStakeholderMock(), domainObjectMock, translationInfoMock);

            domainObjectMock.AssertWasCalled(m => m.Translate(Arg <CultureInfo> .Is.Equal(translationInfoMock.CultureInfo)));
        }
        public void TestThatDispatchThrowsArgumentNullExceptionWhenTranslationInfoIsNull()
        {
            var communicationRepositoryMock = MockRepository.GenerateMock <ICommunicationRepository>();

            var dispatcherBase = new MyDispatcher <IIdentifiable>(communicationRepositoryMock);

            Assert.That(dispatcherBase, Is.Not.Null);

            var exception = Assert.Throws <ArgumentNullException>(() => dispatcherBase.Dispatch(DomainObjectMockBuilder.BuildStakeholderMock(), MockRepository.GenerateMock <IIdentifiable>(), null));

            Assert.That(exception, Is.Not.Null);
            Assert.That(exception.ParamName, Is.Not.Null);
            Assert.That(exception.ParamName, Is.Not.Empty);
            Assert.That(exception.ParamName, Is.EqualTo("translationInfo"));
            Assert.That(exception.InnerException, Is.Null);
        }