public void GetMessageWithNoParentMessageSourceAndNullDefaultMessageSourceResolvableAndCulture() { IMessageSourceResolvable resolver = new DefaultMessageSourceResolvable( new string[] { "foo" }, new object[] {}, string.Empty); DelegatingMessageSource source = new DelegatingMessageSource(); Assert.Throws <NoSuchMessageException>(() => source.GetMessage(resolver, CultureInfo.InvariantCulture)); }
public void GetMessage() { const string expectedName = "Rick Evans"; Expect.Call(MockMessageSource.GetMessage(LookupKey)).Return(expectedName); DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource); mocks.ReplayAll(); string name = source.GetMessage(LookupKey); Assert.AreEqual(expectedName, name); mocks.VerifyAll(); }
public void GetMessageWithMessageSourceResolvableAndCulture() { const string expectedName = "Rick Evans"; DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource); Expect.Call(MockMessageSource.GetMessage((IMessageSourceResolvable)null, CultureInfo.InvariantCulture)).Return(expectedName); mocks.ReplayAll(); string name = source.GetMessage( (IMessageSourceResolvable)null, CultureInfo.InvariantCulture); Assert.AreEqual(expectedName, name); mocks.VerifyAll(); }
public void GetMessageWithCultureAndParams() { const string expectedName = "Rick Evans"; Expect.Call(MockMessageSource.GetMessage(LookupKey, CultureInfo.InvariantCulture, new string[] { "Rick", "Evans" })) .Return(expectedName); DelegatingMessageSource source = new DelegatingMessageSource(MockMessageSource); mocks.ReplayAll(); string name = source.GetMessage(LookupKey, CultureInfo.InvariantCulture, "Rick", "Evans"); Assert.AreEqual(expectedName, name); mocks.VerifyAll(); }
public void GetMessageWithNoParentMessageSourceAndMessageSourceResolvableAndCulture() { const string expectedName = "Rick Evans"; IMessageSourceResolvable resolvable = mocks.StrictMock <IMessageSourceResolvable>(); Expect.Call(resolvable.DefaultMessage).Return(expectedName); Expect.Call(resolvable.DefaultMessage).Return(expectedName); DelegatingMessageSource source = new DelegatingMessageSource(); mocks.ReplayAll(); string name = source.GetMessage(resolvable, CultureInfo.InvariantCulture); Assert.AreEqual(expectedName, name); //mock.Verify(); mocks.VerifyAll(); }
public void GetMessageNoDelegateTarget() { DelegatingMessageSource source = new DelegatingMessageSource(); Assert.Throws <NoSuchMessageException>(() => source.GetMessage(LookupKey)); }
public void GetMessageWithCultureAndParamsNoDelegateTarget() { DelegatingMessageSource source = new DelegatingMessageSource(); Assert.Throws <NoSuchMessageException>(() => source.GetMessage(LookupKey, CultureInfo.InvariantCulture, "Rick", "Evans")); }