public void DefaultResolvableFromExistingResolvable() { IMessageSourceResolvable res = (IMessageSourceResolvable)mocks.CreateMock(typeof(IMessageSourceResolvable)); Expect.Call(res.DefaultMessage).Return("defaultMessageFromMock").Repeat.AtLeastOnce(); Expect.Call(res.GetCodes()).Return(new string[] { "code1FromMock" }); Expect.Call(res.GetArguments()).Return(new object[] { "ArgumentFromMock" }).Repeat.AtLeastOnce(); mocks.ReplayAll(); DefaultMessageSourceResolvable dmr = new DefaultMessageSourceResolvable(res); Assert.AreEqual("defaultMessageFromMock", dmr.DefaultMessage, "default"); Assert.AreEqual("code1FromMock", dmr.LastCode, "codes"); Assert.AreEqual("ArgumentFromMock", (dmr.GetArguments())[0], "arguments"); mocks.VerifyAll(); }
public void DefaultResolvableFromExistingResolvable() { IMessageSourceResolvable res = A.Fake <IMessageSourceResolvable>(); A.CallTo(() => res.DefaultMessage).Returns("defaultMessageFromMock"); A.CallTo(() => res.GetCodes()).Returns(new string[] { "code1FromMock" }); A.CallTo(() => res.GetArguments()).Returns(new object[] { "ArgumentFromMock" }); DefaultMessageSourceResolvable dmr = new DefaultMessageSourceResolvable(res); Assert.AreEqual("defaultMessageFromMock", dmr.DefaultMessage, "default"); Assert.AreEqual("code1FromMock", dmr.LastCode, "codes"); Assert.AreEqual("ArgumentFromMock", (dmr.GetArguments())[0], "arguments"); }
public void DefaultResolvableFromExistingResolvable() { IMessageSourceResolvable res = mocks.StrictMock <IMessageSourceResolvable>(); Expect.Call(res.DefaultMessage).Return("defaultMessageFromMock").Repeat.AtLeastOnce(); Expect.Call(res.GetCodes()).Return(new string[] { "code1FromMock" }); Expect.Call(res.GetArguments()).Return(new object[] { "ArgumentFromMock" }).Repeat.AtLeastOnce(); mocks.ReplayAll(); DefaultMessageSourceResolvable dmr = new DefaultMessageSourceResolvable(res); Assert.AreEqual("defaultMessageFromMock", dmr.DefaultMessage, "default"); Assert.AreEqual("code1FromMock", dmr.LastCode, "codes"); Assert.AreEqual("ArgumentFromMock", (dmr.GetArguments())[0], "arguments"); mocks.VerifyAll(); }