Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        public void SimpleNegativeRetryerTest()
        {
            var retryerUtils = new RetryerUtils(5, TimeSpan.FromSeconds(3), TimeSpan.FromSeconds(1));
            var success      = retryerUtils.Retry(() => SimpleTestAction("NegativeTest"));

            StfAssert.IsFalse("NegativeTest", success);
        }
Exemplo n.º 3
0
        public void TestSetValueOnExistingKey()
        {
            var stfConfiguration = new StfConfiguration(@"TestData\Defaulting\NoDefaultSection.xml");

            StfAssert.IsFalse("Trying to set non existing value",
                              stfConfiguration.SetConfigValue("Users.Ulrich.FortyTwo", "New_Ulrich"));

            string configValue;

            StfAssert.IsFalse("Can't get value", stfConfiguration.TryGetKeyValue("Users.Ulrich.FortyTwo", out configValue));
        }
Exemplo n.º 4
0
        public void TestMethodAsserts()
        {
            StfLogger.LogLevel = StfLogLevel.Internal;
            StfAssert.EnableNegativeTesting = true;

            StfAssert.IsTrue("True Value for IsTrue", true);
            StfAssert.IsTrue("False Value for IsTrue", false);
            StfAssert.IsTrue("2 > 3 Value for IsTrue", 2 > 3);
            StfAssert.IsTrue("3 > 2 Value for IsTrue", 3 > 2);

            StfAssert.IsFalse("True Value for IsFalse", true);
            StfAssert.IsFalse("False Value for IsFalse", false);
            StfAssert.IsFalse("2 > 3 Value for IsFalse", 2 > 3);
            StfAssert.IsFalse("3 > 2 Value for IsFalse", 3 > 2);

            // setting to true resets count of failures
            StfAssert.ResetStatistics();
        }
Exemplo n.º 5
0
 public void TestMethodAssertFalse()
 {
     Assert.IsFalse(StfAssert.IsFalse("true", true));
     Assert.IsTrue(StfAssert.IsFalse("false", false));
 }
Exemplo n.º 6
0
        public void Tc028()
        {
            // User #1: Add a wrap
            var collection = GetCurrentUserCollection();

            // Add a wrap
            var wrapToGo   = collection.GetRandomWrap();
            var wtId       = wrapToGo.WtId;
            var wtApi      = Get <IWtApi>();
            var wrapInfo   = wtApi.WrapInfoByTrackId(wtId);
            var internalId = wrapInfo.InternalId;

            WrapTrackShell.Logout();

            // user #2 want the new wrap
            var anotherUser = GetAnotherUser(WrapTrackShell);

            // TODO: pw should not be hardcoded
            WrapTrackShell.Login(anotherUser, "wraptrack4ever");

            // Move to the new wrap
            var desiredWrap = WrapTrackShell.GetToWrap(internalId);

            desiredWrap.AskFor();
            WrapTrackShell.Logout();

            // User #1: Don't want to pass on
            WrapTrackShell.Login(); // Default user
            WrapTrackShell.Me();

            // navigate to the news page - and then to request page
            WrapTrackShell.WebAdapter.ButtonClickById("nav_home");
            WrapTrackShell.WebAdapter.ButtonClickById("navRequests");

            var testNoRequests = WrapTrackShell.WebAdapter.FindElement(By.Id("textNoRequests"));
            var respons        = testNoRequests.Displayed;

            StfAssert.IsFalse("Dont want to hear 'no pending requests'", respons);

            // On actual page: Find button Decline
            var xPath  = $"//a[text()='{wtId}']/../../../../../..//button[@id='butDeclineReq']";
            var retVal = WrapTrackShell.WebAdapter.Click(By.XPath(xPath));

            if (!retVal)
            {
                StfAssert.IsFalse("Decline button not found", true);
            }

            // Find the ''yes'Im-sure'
            var xPath2  = $"//a[text()='{wtId}']/../../../../../..//button[@id='butDoDecline']";
            var retVal2 = WrapTrackShell.WebAdapter.Click(By.XPath(xPath2));

            // Click to accept the request
            if (!retVal2)
            {
                StfAssert.IsFalse("Do-decline button not found", true);
            }

            // Assert: The link to <wtId> is gone (request handled)
            Wait(TimeSpan.FromSeconds(1));
            var xPath3  = $"//a[text()='{wtId}']";
            var retVal3 = WrapTrackShell.WebAdapter.FindElement(By.XPath(xPath3));

            StfAssert.IsNull("Reqest is gone", retVal3);

            // Assert: User#2 not new owner
            var validationTarget = Get <IWtApi>();
            var wrapInfoAfter    = validationTarget.WrapInfoByTrackId(wtId);
            var newOwnerName     = wrapInfoAfter.OwnerName;

            StfAssert.AreNotEqual("User #2 is not new owner", newOwnerName, anotherUser);
        }