Beispiel #1
0
        public void EvaluateNonConfigAttributeTest()
        {
            //Arrange
            var config = new Mock <IConfigurationProvider>();
            //Act
            var app = new TestConsoleApp(config.Object);

            //Assert
            Assert.IsNull(app.Test);
            Assert.IsNull(app.SpecificValue);
            Assert.IsNull(app.NonConfigProperty);
        }
Beispiel #2
0
        public void EvaluateConfigAttributeTestMultiple()
        {
            var config = new Mock <IConfigurationProvider>();

            config.Setup(c => c.GetSetting(It.IsAny <string>())).Returns((string input) => String.Concat(input, "value"));
            config.Setup(c => c.GetSetting(It.Is <String>(s => s == "SpecificValue"))).Returns("SpecificResult");
            //act
            var app = new TestConsoleApp(config.Object);

            //assert
            Assert.AreEqual("Testvalue", app.Test);
            Assert.AreEqual("SpecificResult", app.SpecificValue);
            Assert.IsNull(app.NonConfigProperty);
        }
Beispiel #3
0
        public void EvaluateConfigAttributeTestStatic()
        {
            //Arrange
            var config = new Mock <IConfigurationProvider>();

            config.Setup(c => c.GetSetting(It.IsAny <string>())).Returns("static");
            //Act
            var app = new TestConsoleApp(config.Object);

            //Assert
            Assert.AreEqual("static", app.Test);
            Assert.AreEqual("static", app.SpecificValue);
            Assert.IsNull(app.NonConfigProperty);
        }