public void Tc027() { const string ChapterText = "Some text to add from TC027"; StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); WrapTrackShell.SignUp(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("me", me); var collection = me.GetCollection(); StfAssert.IsNotNull("Got my collection", collection); var newWrap = collection.AddWrap("Ali Dover", "Hygge", "blue"); var wrap = GetToWrap(newWrap); var addChapter = AddChapter(wrap, ChapterText); StfAssert.IsTrue("Added Chapter", addChapter); var doesNewsExist = DoesNewsExist(newWrap, ChapterText); StfAssert.IsTrue("Does news exist for the added Chapter", doesNewsExist); StfLogger.LogInfo("Hi Brian, here is the currently logged in user {0}", WrapTrackShell.CurrentLoggedInUser); }
/// <summary> /// The helper test Pad.... functions. /// </summary> /// <param name="source"> /// The source string /// </param> /// <param name="oldValue"> /// The old Value. /// </param> /// <param name="newValue"> /// The new Value. /// </param> /// <param name="expected"> /// The expected value of the transformed string /// </param> private void HelperTestReplace(string source, string oldValue, string newValue, string expected) { var arg = $@"""Replace"" ""{source}"" ""{oldValue}"" ""{newValue}"""; var actual = stringTransformationUtils.EvaluateFunction("STRING", arg); StfAssert.AreEqual($"Unittest Replace test actual / expected", expected, actual); }
public void Tc038() { StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); WrapTrackShell.SignUp(); var criteria = EnumExtensions.GetRandomEnum <ModelReviewProperties>(); var criteriaText = criteria.GetDisplayName(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("me", me); var collection = me.GetCollection(); StfAssert.IsNotNull("Got my collection", collection); var newWrap = collection.AddWrap(BrandName, PatternName, ModelName); var wrap = GetToWrap(newWrap); var makeEvaluationForWrap = MakeEvaluationForWrap(wrap, criteria); StfAssert.IsTrue("evaluation made for wrap", makeEvaluationForWrap); var doesNewsOfCarrierEvaluationExist = DoesNewsOfCarrierEvaluationExist(ModelName, criteriaText); StfAssert.IsTrue("Does news exist that carrier has an evaluation", doesNewsOfCarrierEvaluationExist); }
public void TestMethodAssertGreaterThan() { var obj1 = new DateTime(42); var obj2 = new DateTime(4242); Assert.IsTrue(StfAssert.GreaterThan("2 > 1", 2, 1)); Assert.IsTrue(StfAssert.GreaterThan("2.0 > 1", 2.0, 1)); Assert.IsFalse(StfAssert.GreaterThan("1 > \"2\"", 1, "2")); Assert.IsTrue(StfAssert.GreaterThan("1 > \"1.0\"", 1, "1.0")); Assert.IsFalse(StfAssert.GreaterThan("\"\" > \"\"", string.Empty, string.Empty)); Assert.IsFalse(StfAssert.GreaterThan("\"\" > \" \"", string.Empty, " ")); Assert.IsTrue(StfAssert.GreaterThan("\" \" > \" \"", " ", string.Empty)); Assert.IsFalse(StfAssert.GreaterThan("\"a\" > \"A\"", "a", "A")); Assert.IsTrue(StfAssert.GreaterThan("\"A\" > \"a\"", "A", "a")); Assert.IsFalse(StfAssert.GreaterThan("\"string\" > \"string\"", "string", "string")); Assert.IsFalse(StfAssert.GreaterThan("obj1 = obj1", obj1, obj1)); Assert.IsFalse(StfAssert.GreaterThan("obj1 = obj2", obj1, obj2)); Assert.IsTrue(StfAssert.GreaterThan("obj2 = obj1", obj2, obj1)); // fail scenarios Assert.IsFalse(StfAssert.GreaterThan("obj1 = 1", obj1, 1)); // a bit funky - the object obj1 is converted to string, and then the strings are compared. Assert.IsTrue(StfAssert.GreaterThan("obj1 = \"string\"", obj1, "string")); }
/// <summary> /// The helper test ToUpper.... function. /// </summary> /// <param name="toCase"> /// The toCase string ToUpper or ToLower /// </param> /// <param name="source"> /// The source string /// </param> /// <param name="expected"> /// The expected string /// </param> private void HelperTestToCase(string toCase, string source, string expected) { var arg = $@"""{toCase}"" ""{source}"""; var actual = stringTransformationUtils.EvaluateFunction("STRING", arg); StfAssert.AreEqual($"Unittest {toCase} test actual / expected", expected, actual); }
public void TestMethodGetPluginTypeTest() { // need to load the UnitTest plug-ins LoadAdditionalStfPlugins(".", "Stf.UnitTestPlugin*.dll"); var sp2 = Get <IStfUnitTestPlugin2>(); StfAssert.IsNotNull("Get<IStfUnitTestPlugin2>", sp2); StfAssert.AreEqual("sp2.StfUnitTestPlugin2Func", 102, sp2.StfUnitTestPlugin2Func()); var plugin2Type = Get <ITestPluginModel>(); StfAssert.IsNotNull("Get<ITestPluginModel>", plugin2Type); StfAssert.AreEqual("plugin2Type.TestPluginFunc", 202, plugin2Type.TestPluginFunc()); var plugin2Type2 = Get <ITestPluginModel2>(); StfAssert.IsNotNull("Get<ITestPluginModel>", plugin2Type2); StfAssert.AreEqual("plugin2Type.TestPluginFunc", "2+2=4", plugin2Type2.TestPlugin2FuncWithParams("2+2", 4)); StfAssert.AreEqual("plugin2Type.TestProp", "Default", plugin2Type2.TestProp); plugin2Type2.TestProp = "NewValue"; StfAssert.AreEqual("plugin2Type.TestProp", "NewValue", plugin2Type2.TestProp); StfAssert.AreEqual("Plugin2Func", 203, plugin2Type2.TestPlugin2Func()); }
public void Tc015() { // For now hard coded. TOdo: Random const string BrandId = "289"; const string BrandName = "Agossie"; // Use default user WrapTrackShell.Login(); StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); var randomBrand = this.GetBrand(BrandName); var newPatternName = WtUtils.GetRandomString("StfPattern"); var baseLineNumberOfPatterns = wtApi.BrandNumberOfPatterns(BrandId); var patternAdded = randomBrand.AddPattern(newPatternName); var numberOfPatterns = wtApi.BrandNumberOfPatterns(BrandId); StfAssert.IsTrue($"Pattern {newPatternName} Added", patternAdded); StfAssert.GreaterThan("Number of patterns for brand up by one", numberOfPatterns, baseLineNumberOfPatterns); var patternDeleted = randomBrand.DeletePattern(newPatternName); StfAssert.IsTrue($"Pattern {newPatternName} Deleted", patternDeleted); numberOfPatterns = wtApi.BrandNumberOfPatterns(BrandId); StfAssert.AreEqual($"Number of patterns for brand as baseline", numberOfPatterns, baseLineNumberOfPatterns); }
/// <summary> /// The helper test file paths all steps. /// </summary> /// <param name="testCaseName"> /// The test case name. /// </param> /// <param name="testCaseId"> /// The test case id. /// </param> /// <param name="fileNameFilters"> /// The file name filters. /// </param> /// <param name="numSteps"> /// The num steps. /// </param> /// <param name="expectedFilePaths"> /// The expected file paths. /// </param> private void HelperTestFilePathsAllSteps( string testCaseName, int testCaseId, string[] fileNameFilters, int numSteps, string[,] expectedFilePaths) { StfLogger.LogHeader(testCaseName); var testCaseFileAndFolderUtils = new TestCaseFileAndFolderUtils(testCaseId, UnitTestTestDataRoot); var testCaseStepFilePathUtils = new TestCaseStepFilePathUtils( testCaseFileAndFolderUtils.TestCaseDirectory, fileNameFilters, true); for (int stepNum = 1; stepNum <= numSteps; stepNum++) { StfLogger.LogSubHeader($"Step {stepNum}"); for (var fileNameFilterNo = 0; fileNameFilterNo < fileNameFilters.Length; fileNameFilterNo++) { var actual = testCaseStepFilePathUtils.GetFileNameForStep(fileNameFilters[fileNameFilterNo], stepNum); StfAssert.AreEqual( "FileNames for step are equal", expectedFilePaths[stepNum - 1, fileNameFilterNo], actual); } } }
public void TestTestCaseDirectoryDoesNotExists() { var testCaseFileAndFolderUtils = new TestCaseFileAndFolderUtils(5001, UnitTestTestDataRoot); var actual = testCaseFileAndFolderUtils.TestCaseDirectory; StfAssert.IsNull("TestCaseDirectory does not exists", actual); }
public void TestMethodAssertInconclusive() { Assert.IsTrue(StfAssert.IsInconclusive("Check is inconclusive", "Inconclusive")); StfAssert.AreEqual("Current inconclusives", 1, StfAssert.CurrentInconclusives); StfAssert.AreEqual("Current failures", 0, StfAssert.CurrentFailures); StfAssert.AreEqual("Current passes", 2, StfAssert.CurrentPasses); }
public void Tc008() { var pathToNewImage = GetNewImagePath(); var collection = GetCurrentUserCollection(WrapTrackShell); var myWrap = collection.GetRandomWrap(); // Find number of pictures before (to wrap and to ownership) var validationTarget = Get <IWtApi>(); var wtId = myWrap.WtId; // tracking-id var beforeWrapPic = GetNumberOfPictures(validationTarget, wtId); var beforeOwnershipPic = GetNumberOfOwnershipPic(validationTarget, wtId); // Do upload myWrap.UploadWrapImage(pathToNewImage); // Find number of pictures after upload Wait(TimeSpan.FromSeconds(3)); var afterWrapPic = GetNumberOfPictures(validationTarget, wtId); var newNumWrapPic = beforeWrapPic + 1; StfAssert.AreEqual("One more picture related to wrap", newNumWrapPic, afterWrapPic); var afterOwnershipPic = GetNumberOfOwnershipPic(validationTarget, wtId); var newNumOwnershipPic = beforeOwnershipPic + 1; StfAssert.AreEqual("One more picture related to ownership", afterOwnershipPic, newNumOwnershipPic); }
public void TestMethod1() { string[] header = { "et", "to", "tre" }; var wtu = new TableUtils(header); StfAssert.StringEquals("Et", wtu.Columns[0].Name, "et"); }
public void TestMethodAssertLessThan() { var myLogger = new Stf.Utilities.StfLogger { FileName = @"c:\temp\unittestlogger_TestMethodAssertLessThan.html" }; var myAsserts = new StfAssert(myLogger); var obj1 = new DateTime(42); var obj2 = new DateTime(4242); myAsserts.EnableNegativeTesting = true; Assert.IsFalse(myAsserts.AssertLessThan("2 < 1", 2, 1)); Assert.IsFalse(myAsserts.AssertLessThan("2.0 < 1", 2.0, 1)); Assert.IsTrue(myAsserts.AssertLessThan("1 < \"2\"", 1, "2")); Assert.IsFalse(myAsserts.AssertLessThan("1 < \"1.0\"", 1, "1.0")); Assert.IsFalse(myAsserts.AssertLessThan("\"\" < \"\"", string.Empty, string.Empty)); Assert.IsTrue(myAsserts.AssertLessThan("\"\" < \" \"", string.Empty, " ")); Assert.IsFalse(myAsserts.AssertLessThan("\" \" < \" \"", " ", string.Empty)); Assert.IsTrue(myAsserts.AssertLessThan("\"a\" < \"A\"", "a", "A")); Assert.IsFalse(myAsserts.AssertLessThan("\"A\" < \"a\"", "A", "a")); Assert.IsFalse(myAsserts.AssertLessThan("\"string\" < \"string\"", "string", "string")); Assert.IsFalse(myAsserts.AssertLessThan("obj1 < obj1", obj1, obj1)); Assert.IsTrue(myAsserts.AssertLessThan("obj1 < obj2", obj1, obj2)); Assert.IsFalse(myAsserts.AssertLessThan("obj2 < obj1", obj2, obj1)); // fail scenarios Assert.IsFalse(myAsserts.AssertLessThan("obj1 = 1", obj1, 1)); // a bit funky - the object obj1 is converted to string, and then the strings are compared. Assert.IsFalse(myAsserts.AssertLessThan("obj1 = \"string\"", obj1, "string")); }
public void TestMethodAssertEquals() { var myLogger = new Stf.Utilities.StfLogger { FileName = @"c:\temp\unittestlogger_TestMethodAssertEquals.html" }; var myAsserts = new StfAssert(myLogger); var obj1 = new DateTime(42); var obj2 = new DateTime(4242); myAsserts.EnableNegativeTesting = true; Assert.IsTrue(myAsserts.AssertEquals("1 = 1", 1, 1)); Assert.IsFalse(myAsserts.AssertEquals("1 = 1.0", 1, 1.0)); Assert.IsFalse(myAsserts.AssertEquals("1 = \"1\"", 1, "1")); Assert.IsFalse(myAsserts.AssertEquals("1 = \"1.0\"", 1, "1.0")); Assert.IsTrue(myAsserts.AssertEquals("\"\" == \"\"", string.Empty, string.Empty)); Assert.IsFalse(myAsserts.AssertEquals("\"\" == \" \"", string.Empty, " ")); Assert.IsFalse(myAsserts.AssertEquals("\" \" == \" \"", " ", string.Empty)); Assert.IsFalse(myAsserts.AssertEquals("\"A\" == \"a\"", "A", "a")); Assert.IsTrue(myAsserts.AssertEquals("\"string\" == \"string\"", "string", "string")); Assert.IsTrue(myAsserts.AssertEquals("obj1 = obj1", obj1, obj1)); Assert.IsFalse(myAsserts.AssertEquals("obj1 = obj2", obj1, obj2)); // fail scenarios Assert.IsFalse(myAsserts.AssertEquals("obj1 = 1", obj1, 1)); Assert.IsFalse(myAsserts.AssertEquals("obj1 = \"string\"", obj1, "string")); }
public void TestMethodContainerExtensionInitializesPlugin() { // need to load the UnitTest plug-ins LoadAdditionalStfPlugins(".", "Stf.UnitTestPlugin*.dll"); var sp2 = Get <IStfUnitTestPlugin2>(); StfAssert.IsNotNull("sp2.StfContainer != null", sp2.StfContainer); var pluginModel = sp2.StfContainer.Get <ITestPluginModel>(); StfAssert.IsNotNull("sp1.IsInitialized", pluginModel); var pluginModel2 = sp2.StfContainer.Get <ITestPluginModel2>(); StfAssert.IsNotNull("sp1.IsInitialized", pluginModel2); var pluginAdapter = sp2.StfContainer.Get <ITestPluginModel2>(); StfAssert.IsNotNull("sp1.IsInitialized", pluginAdapter); var pluginTypeWithoutInterface = sp2.StfContainer.Get <TestPluginTypeWithoutInterface>(); StfAssert.IsNotNull("sp1.IsInitialized", pluginTypeWithoutInterface); var testAdapterWithoutInterface = sp2.StfContainer.Get <TestAdapterWithoutInterface>(); StfAssert.IsNotNull("sp1.IsInitialized", testAdapterWithoutInterface); }
public void Tc013() { // Create a wrap to convert var wtId = Collection.AddWrap("Baie", "Duet", "En Bleu", 8); StfAssert.IsNotNull("Got the original wrap size 8", wtId); // Status of original wrap before var validationTarget = Get <IWtApi>(); var wrapInfo = validationTarget.WrapInfoByTrackId(wtId); var statusBefore = wrapInfo.Status; StfAssert.AreEqual("Status before deleting is 0", statusBefore, "0"); // Create two small wraps var smallWrap1 = Collection.AddWrap("Baie", "Duet", "En Bleu", 2); var smallWrap2 = Collection.AddWrap("Baie", "Duet", "En Bleu", 2); StfAssert.IsNotNull("Got one small wrap size 2", smallWrap1); StfAssert.IsNotNull("Got one more small wrap size 2", smallWrap2); // Mark the test script as InProgress StfAssert.IsNotNull("TestCase NOT finished", null); // TODO: Again we need orgWrap to be a IWrap // orgWrap.Convert(smallWrap1); // Not implemented // orgWrap.extraConvention(smallWrap2); // Not implemented }
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 TestMethodPredicate() { var peopleList = new List <People>() { new People { Name = "Name1", Age = 41, Height = 1.1 }, new People { Name = "Name2", Age = 42, Height = 1.2 }, new People { Name = "Name3", Age = 43, Height = 1.3 } }; var predicate = new Predicate(); PeopleFilter filter; List <People> result; filter = new PeopleFilter { AgeFilter = 42 }; result = predicate.FilterList(peopleList, filter); StfAssert.IsTrue("Found", result.Any()); StfAssert.AreEqual("Found", result.FirstOrDefault().Name, "Name2"); filter = new PeopleFilter { Name = "Name3" }; result = predicate.FilterList(peopleList, filter); StfAssert.IsTrue("Found", result.Any()); StfAssert.AreEqual("Found", result.FirstOrDefault().Age, 43); }
public void Tc036() { const string TypeOfSale = "for sale (FSO)"; StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); WrapTrackShell.SignUp(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("me", me); var collection = me.GetCollection(); StfAssert.IsNotNull("Got my collection", collection); var newWrap = collection.AddWrap("Ali Dover", "Hygge", "blue"); var wrap = GetToWrap(newWrap); var markWrapForSale = MarkWrapForSale(wrap, TypeOfSale); StfAssert.IsTrue("Marked carrier for sale", markWrapForSale); var doesNewsOfCarrierForSaleExist = this.DoesNewsOfCarrierForSaleExist(newWrap, TypeOfSale); StfAssert.IsTrue("Does news exist that carrier is for sale", doesNewsOfCarrierForSaleExist); }
public void TestMethodParsePredicate() { var predicate = new Predicate(); var filter = predicate.ParsePredicate <PeopleFilter>("Age = 42"); StfAssert.AreEqual("Found", filter.AgeFilter, 42); }
public void TestMethodAssertEqualLessThan() { var obj1 = new DateTime(42); var obj2 = new DateTime(4242); Assert.IsFalse(StfAssert.LessThanOrEqual("2 < 1", 2, 1)); Assert.IsFalse(StfAssert.LessThanOrEqual("2.0 < 1", 2.0, 1)); Assert.IsTrue(StfAssert.LessThanOrEqual("1 < \"2\"", 1, "2")); Assert.IsFalse(StfAssert.LessThanOrEqual("1 < \"1.0\"", 1, "1.0")); Assert.IsTrue(StfAssert.LessThanOrEqual("1 < 1.0", 1, 1.0)); Assert.IsTrue(StfAssert.LessThanOrEqual("1.0 < 1", 1.0, 1)); Assert.IsTrue(StfAssert.LessThanOrEqual("\"\" < \"\"", string.Empty, string.Empty)); Assert.IsTrue(StfAssert.LessThanOrEqual("\"\" < \" \"", string.Empty, " ")); Assert.IsFalse(StfAssert.LessThanOrEqual("\" \" < \" \"", " ", string.Empty)); Assert.IsTrue(StfAssert.LessThanOrEqual("\"a\" < \"A\"", "a", "A")); Assert.IsFalse(StfAssert.LessThanOrEqual("\"A\" < \"a\"", "A", "a")); Assert.IsTrue(StfAssert.LessThanOrEqual("\"string\" < \"string\"", "string", "string")); Assert.IsTrue(StfAssert.LessThanOrEqual("obj1 < obj1", obj1, obj1)); Assert.IsTrue(StfAssert.LessThanOrEqual("obj1 < obj2", obj1, obj2)); Assert.IsFalse(StfAssert.LessThanOrEqual("obj2 < obj1", obj2, obj1)); // fail scenarios Assert.IsFalse(StfAssert.LessThanOrEqual("obj1 = 1", obj1, 1)); // a bit funky - the object obj1 is converted to string, and then the strings are compared. Assert.IsFalse(StfAssert.LessThanOrEqual("obj1 = \"string\"", obj1, "string")); }
public void TestLogAllTypesOfOutcome() { var iteration = StfIterationNo; switch (iteration) { case 1: StfAssert.IsTrue("Pass", true); break; case 2: StfAssert.IsTrue("Fail", false); break; case 3: StfAssert.IsInconclusive("Inconclusive", "Inconclusive"); break; case 4: StfLogger.LogWarning("Warning", "Warning"); break; case 5: StfLogger.LogError("Error", "Error"); break; } }
public void TestDefaultGetSetConfigValues() { // Load a configuration in StfConfiguration var stfConfiguration = new StfConfiguration(@"TestData\Defaulting\DefaultSectionWithEnvironments.xml"); stfConfiguration.Environment = stfConfiguration.DefaultEnvironment; var dUsername = stfConfiguration.GetConfigValue("Users.Username"); var dPassword = stfConfiguration.GetConfigValue("Users.Password"); StfAssert.AreEqual("Default Username is User_Kasper", "User_Kasper", dUsername); StfAssert.AreEqual("Default Password is K999", "K999", dPassword); var newUserName = "******"; var newUserPassword = "******"; stfConfiguration.SetConfigValue("Users.Username", newUserName); stfConfiguration.SetConfigValue("Users.Password", newUserPassword); dUsername = stfConfiguration.GetConfigValue("Users.Username"); dPassword = stfConfiguration.GetConfigValue("Users.Password"); StfAssert.AreEqual("Default Username is updated", newUserName, dUsername); StfAssert.AreEqual("Default Password is updated", newUserPassword, dPassword); }
public void Tc037() { const string ReviewText = "This is an automated review by TC037"; const string BrandName = "Agossie"; const string PatternName = "Orchid"; const string ModelName = "Glores"; StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); WrapTrackShell.SignUp(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("me", me); var collection = me.GetCollection(); StfAssert.IsNotNull("Got my collection", collection); var newWrap = collection.AddWrap(BrandName, PatternName, ModelName); var wrap = GetToWrap(newWrap); var writeReviewForWrap = WriteReviewForWrap(wrap, ReviewText); StfAssert.IsTrue("Review written for wrap", writeReviewForWrap); var doesNewsOfCarrierReviewExist = DoesNewsOfCarrierReviewExist(ModelName, ReviewText); StfAssert.IsTrue("Does news exist that carrier has a review", doesNewsOfCarrierReviewExist); }
/// <summary> /// The helper test TrimEnd.... functions. /// </summary> /// <param name="direction"> /// The direction. /// </param> /// <param name="source"> /// The source string /// </param> /// <param name="trimChars"> /// The trim Chars. /// </param> /// <param name="expected"> /// The expected value of the transformed string /// </param> private void HelperTestTrim(string direction, string source, string trimChars, string expected) { var arg = $@"""{direction}"" ""{source}"" ""{trimChars}"""; var actual = stringTransformationUtils.EvaluateFunction("STRING", arg); StfAssert.AreEqual($"Unittest TrimEnd test actual / expected", expected, actual); }
public void TestMethodAssertFileExists() { const string UnitTestFile = @"c:\temp\TestMethodAssertFileContains.txt"; var myLogger = new Stf.Utilities.StfLogger { FileName = @"c:\temp\unittestlogger_AssertFileExists.html" }; var myAsserts = new StfAssert(myLogger); myAsserts.EnableNegativeTesting = true; if (File.Exists(UnitTestFile)) { File.Delete(UnitTestFile); } Assert.IsFalse(myAsserts.AssertFileExists("TestStepName 1", @"c:\DoNotExists.nope")); Assert.IsFalse(myAsserts.AssertFileExists("TestStepName 2", UnitTestFile)); var testFile = File.CreateText(UnitTestFile); testFile.WriteLine("one line of test data"); testFile.Close(); Assert.IsTrue(myAsserts.AssertFileExists("TestStepName 3", UnitTestFile)); }
/// <summary> /// The helper test Insert.... functions. /// </summary> /// <param name="source"> /// The source string /// </param> /// <param name="startIndex"> /// The startIndex Value. /// </param> /// <param name="value"> /// The value Value. /// </param> /// <param name="expected"> /// The expected value of the transformed string /// </param> private void HelperTestInsert(string source, string startIndex, string value, string expected) { var arg = $@"""Insert"" ""{source}"" ""{startIndex}"" ""{value}"""; var actual = stringTransformationUtils.EvaluateFunction("STRING", arg); StfAssert.AreEqual($"Unittest Insert test actual / expected", expected, actual); }
public void Tc024() { // Set up user context for actual test // Use default user WrapTrackShell.Login(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("WrapTrackShell", this.WrapTrackShell); StfAssert.IsInstanceOfType("me", me, typeof(IMeProfile)); // Actual test // Create a new wrap var wrapCollection = me.GetCollection(); StfAssert.IsNotNull("check if me.GetCollection null", wrapCollection); var newWrapWtId = wrapCollection.AddWrap(); // Move to the new wrap var wrapToSendOnHoliday = this.WrapTrackShell.GetToWrap(newWrapWtId); var recipient = this.GetAnotherUser(); // Send warp away on holiday wrapToSendOnHoliday.SendAwayTemporarily(SendAwayReason.Holiday, recipient); // Validate the the wrap indeed is on holiday var wtApi = this.Get <IWtApi>(); var wrapInfo = wtApi.WrapInfoByTrackId(newWrapWtId); StfLogger.LogInfo("The recipient user name attempted is {0} and userid from wrapInfo API is {1}", recipient, wrapInfo.VisitingUserId); StfAssert.IsTrue("Wrap is on holiday", wrapInfo.OnHoliday); }
public void Tc009() { WrapTrackShell.SignUp(); // new user - empty collection var me = WrapTrackShell.Me(); StfAssert.IsNotNull("We got a me - a brand new user", me); var collection = me.GetCollection(); collection.AddWrap(); // precise 1 wrap in collection var theOneAndOnlyWrap = collection.GetRandomWrap(); var pathToNewImage = GetNewImagePath(); // Find number of pictures before var validationTarget = Get <IWtApi>(); var wtId = theOneAndOnlyWrap.WtId; // tracking-id var numberOfPictures = GetNumberOfPictures(validationTarget, wtId); StfAssert.AreEqual("0 pictures before upload", 0, numberOfPictures); // Do 4 * upload theOneAndOnlyWrap.UploadWrapImage(pathToNewImage, 4); Wait(TimeSpan.FromSeconds(3)); numberOfPictures = GetNumberOfPictures(validationTarget, wtId); StfAssert.AreEqual("4 pictures after upload", numberOfPictures, 4); // Remove two pictures and assert there is 2 picture left this.RemovePicturesFromWrap(theOneAndOnlyWrap, 2); Wait(TimeSpan.FromSeconds(3)); numberOfPictures = GetNumberOfPictures(validationTarget, wtId); StfAssert.AreEqual("2 picture left", 2, numberOfPictures); }
public void Tc002() { // Make sure login is possible WrapTrackShell.Login(); var me = WrapTrackShell.Me(); StfAssert.IsNotNull("wrapTrackShell", WrapTrackShell); StfAssert.IsInstanceOfType("me", me, typeof(IMeProfile)); // try wrong pw WrapTrackShell.Logout(); WrapTrackShell.Login("mie88", "1234"); var feedback = WrapTrackShell.InfoText("mes_loginerror"); StfAssert.IsTrue("User got feedback: 'wrong username/pw'", feedback); // try unkown username WrapTrackShell.Login("detvillemanadrigkaldesig", "wraptrack4ever"); var feedback2 = WrapTrackShell.InfoText("mes_loginerror"); StfAssert.IsTrue("User got feedback: 'wrong username/pw'", feedback2); }