Exemplo n.º 1
0
        public void Show_InfoMessageBox_GeneratedCorrectly()
        {
            var tf = new Mock<ITemplateFactory>();
            tf.Setup(x => x.Load(It.Is<string>(c => c.EndsWith("InfoMessageBox.tpl")))).Returns(new Template("{Title}{Message}", false));

            var st = new Mock<IStringTable>();
            st.Setup(x => x.GetItem(It.Is<string>(c => c == "FormTitleMessageBox"))).Returns("Foo title");

            var dc = new Mock<IDataCollector>();
            dc.Setup(x => x.Add(It.IsAny<string>())).Callback((string str) => Assert.AreEqual("21", str));
            dc.Setup(x => x.AddTitle(It.IsAny<string>())).Callback((string str) => Assert.AreEqual("2", str));

            var mb = new MessageBox(tf.Object, st.Object, dc.Object);
            mb.Show("1", MessageBoxStatus.Information, "2");

            dc.Verify(x => x.Add(It.IsAny<string>()), Times.Once);
        }
Exemplo n.º 2
0
 public void Show_NullParameters_ExceptionsThrown()
 {
     var mb = new MessageBox(null, null, null);
     Assert.Throws<ArgumentNullException>(() => mb.Show(null));
 }