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

            var st = new Mock<IStringTable>();
            var dc = new Mock<IDataCollector>();

            var mb = new MessageBox(tf.Object, st.Object, dc.Object);
            Assert.AreEqual("Foo data", mb.GetInline("Foo data", MessageBoxStatus.Ok));
        }
Ejemplo n.º 2
0
        public void ShowSt_ErrorMessageBox_GeneratedCorrectly()
        {
            var tf = new Mock<ITemplateFactory>();

            tf.Setup(x => x.Load(It.Is<string>(c => c.EndsWith("ErrorMessageBox.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");
            st.Setup(x => x.GetItem(It.Is<string>(c => c == "StTestItem"))).Returns("Foo data");

            var dc = new Mock<IDataCollector>();
            dc.Setup(x => x.Add(It.IsAny<string>())).Callback((string str) => Assert.AreEqual("2Foo data", 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.ShowSt("StTestItem", MessageBoxStatus.Error, "2");

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