public void TestMethodAssertStrings() { var myLogger = new Stf.Utilities.StfLogger { FileName = @"c:\temp\unittestlogger_TestMethodAssertStrings.html" }; var myAsserts = new StfAssert(myLogger); Assert.IsTrue(myAsserts.StringContains("TestStepName 1", "Hejsa", "Hej")); Assert.IsFalse(myAsserts.StringContains("TestStepName 2", "Hejsa", "Bent")); Assert.IsTrue(myAsserts.StringDoesNotContain("TestStepName 3", "Hejsa", "Bent")); Assert.IsFalse(myAsserts.StringDoesNotContain("TestStepName 4", "Hejsa", "Hej")); Assert.IsTrue(myAsserts.StringMatches("TestStepName 5", "Hejsa", "^He.*")); Assert.IsFalse(myAsserts.StringMatches("TestStepName 6", "Hejsa", "Nix.*")); Assert.IsTrue(myAsserts.StringDoesNotMatch("TestStepName 7", "Hejsa", "Nix.*")); Assert.IsFalse(myAsserts.StringDoesNotMatch("TestStepName 8", "Hejsa", "^He.*")); Assert.IsTrue(myAsserts.StringStartsWith("TestStepName 9", "Hejsa", "He")); Assert.IsFalse(myAsserts.StringStartsWith("TestStepName 10", "Hejsa", "hej")); Assert.IsTrue(myAsserts.StringDoesNotStartWith("TestStepName 11", "Hejsa", "hej")); Assert.IsFalse(myAsserts.StringDoesNotStartWith("TestStepName 12", "Hejsa", "He")); Assert.IsTrue(myAsserts.StringEndsWith("TestStepName 13", "Hejsa", "jsa")); Assert.IsFalse(myAsserts.StringEndsWith("TestStepName 14", "Hejsa", "Hej")); Assert.IsTrue(myAsserts.StringDoesNotEndsWith("TestStepName 15", "Hejsa", "Bent")); Assert.IsFalse(myAsserts.StringDoesNotEndsWith("TestStepName 16", "Hejsa", "ejsa")); Assert.IsTrue(myAsserts.StringEquals("TestStepName 17", "Hejsa", "Hejsa")); Assert.IsFalse(myAsserts.StringEquals("TestStepName 18", "Hejsa", "hejsa")); Assert.IsTrue(myAsserts.StringNotEquals("TestStepName 19", "Hejsa", "hejsa")); Assert.IsFalse(myAsserts.StringNotEquals("TestStepName 20", "Hejsa", "Hejsa")); Assert.IsTrue(myAsserts.StringEqualsCi("TestStepName 21", "Hejsa", "hejsa")); Assert.IsFalse(myAsserts.StringEqualsCi("TestStepName 22", "Hejsa", "hej")); Assert.IsTrue(myAsserts.StringNotEqualsCi("TestStepName 23", "Hejsa", "hejs")); Assert.IsFalse(myAsserts.StringNotEqualsCi("TestStepName 24", "Hejsa", "hejsa")); Assert.IsTrue(myAsserts.StringEmpty("TestStepName 25", string.Empty)); Assert.IsFalse(myAsserts.StringEmpty("TestStepName 26", "Hejsa")); Assert.IsTrue(myAsserts.StringNotEmpty("TestStepName 27", "Hejsa")); Assert.IsFalse(myAsserts.StringNotEmpty("TestStepName 28", string.Empty)); }
public void TestStfPluginLoaderRegistersSingletonCorrectly() { LoadAdditionalStfPlugins(".", "Stf.UnitTestPlugin*.dll"); var sp2 = Get <IStfUnitTestPlugin2>(); StfAssert.IsNotNull("sp2 != null", sp2); var pluginObject1 = Get <ITestPluginModel2>(); pluginObject1.TestProp = "Changed"; var pluginObject2 = Get <ITestPluginModel2>(); StfAssert.IsFalse("TestpluginModel is not a singleton", pluginObject1.Equals(pluginObject2)); StfAssert.StringEquals("Object with default value", "Default", pluginObject2.TestProp); StfAssert.StringEquals("Object with changed value", "Changed", pluginObject1.TestProp); var singletonObject = Get <IStfSingletonPluginType>(); StfAssert.IsFalse("Singleton bool is false", singletonObject.SingletonBool); StfAssert.AreEqual("SingletonInteger is 1", 1, singletonObject.SingletonInteger); singletonObject.SingletonBool = true; singletonObject.SingletonInteger++; var singletonObject2 = Get <IStfSingletonPluginType>(); StfAssert.IsTrue("Singleton object is a singleton", singletonObject2.Equals(singletonObject)); StfAssert.IsTrue("Singleton is true", singletonObject2.SingletonBool); StfAssert.AreEqual("SingletonInteger is 2", 2, singletonObject2.SingletonInteger); }
public void TestMethod1() { string[] header = { "et", "to", "tre" }; var wtu = new TableUtils(header); StfAssert.StringEquals("Et", wtu.Columns[0].Name, "et"); }
public void TestMethodAdvanced() { var templifierCalculator = new TemplifierCalculator(); templifierCalculator.Init("BasePrice = {CALC {BasePrice} + {Provision}}"); templifierCalculator.LeftOperator = "23"; templifierCalculator.RightOperator = "45"; StfAssert.StringEquals(templifierCalculator.CurrentTemplifierStatement, "68", templifierCalculator.CalculateExpression()); }
public void TestMethodSimple() { var templifierCalculator = new TemplifierCalculator(); templifierCalculator.Init("{CALC 2 + 2}"); StfAssert.StringEquals(templifierCalculator.CurrentTemplifierStatement, "4", templifierCalculator.CalculateExpression()); templifierCalculator.Init("{CALC 6 / 2}"); StfAssert.StringEquals(templifierCalculator.CurrentTemplifierStatement, "3", templifierCalculator.CalculateExpression()); }
public void TestProjection() { string[] header = { "fornavn", "efternavn", "gadeNavn", "gadeNummer" }; string[] row = { "Ulrich", "Freiberg", "Æblestien", "13" }; var tableUtils = new TableUtils(header); var rowType = tableUtils.Projection <UnitTestProjection>(row); StfAssert.StringEquals("Æblestien", "Æblestien", rowType.Gadenavn); }
public void TestMethod3() { string[] header = { "fornavn", "efternavn", "gadeNavn", "gadeNummer" }; string[] row = { "Ulrich", "Freiberg", "Æblestien", "13" }; var wtu = new TableUtils(header); var rowType = wtu.GetRowType(row); StfAssert.StringEquals("Æblestien", "Æblestien", rowType.gadeNavn); StfAssert.StringEquals("fornavn", "fornavn", wtu.Columns[0].Name); }
public void TestMethod2() { string[] header = { "fornavn", "efternavn", "gadeNavn", "gadeNummer" }; var wtu = new TableUtils(header); var rowType = wtu.GetRowType(); StfAssert.StringEmpty("Empty", rowType.gadeNavn); rowType.gadeNavn = "Æblestien"; StfAssert.StringEquals("Gadenavn", "Æblestien", rowType.gadeNavn); StfAssert.StringEquals("fornavn", "fornavn", wtu.Columns[0].Name); }