IsFalse() публичный статический Метод

public static IsFalse ( bool value, string msg ) : void
value bool
msg string
Результат void
Пример #1
0
        public TestResult VerifyCloseOnProjectOpenCheckbox(Application application, Log log)
        {
            const string prefix = "Close welcome tab on project open";
            var result = new TestResult();
            var assert = new Assert(result, log);
            try
            {
                var startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    log.Info(prefix, "Opening start page.");
                    MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);
                }

                startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    var message = "Failed to get the start page.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                try
                {
                    if (!startPage.IsSelected)
                    {
                        log.Info(prefix, "Setting focus to start page.");
                        startPage.Select();
                    }
                }
                catch (Exception e)
                {
                    var message = string.Format(
                        CultureInfo.InvariantCulture,
                        "Failed to select the start page tab. Error was: {0}",
                        e);
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);

                    return result;
                }

                // Check 'keep open' flag
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);

                // New button
                var newProjectSearchCriteria = SearchCriteria
                    .ByAutomationId(WelcomeViewAutomationIds.NewProject);
                var newProjectButton = (Button)startPage.Get(newProjectSearchCriteria);
                if (newProjectButton == null)
                {
                    var message = "Failed to get the 'New Project' button.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                newProjectButton.Click();

                // Check that the start page hasn't been closed
                var currentStartPage = TabProxies.GetStartPageTabItem(application, log);
                assert.IsNotNull(currentStartPage, prefix + " - Start page does not exist after opening project");
                assert.IsFalse(currentStartPage.IsSelected, prefix + " - Start page is selected after opening project");

                var currentProjectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(currentProjectPage, prefix + " - Project page does not exist after opening project");
                assert.IsTrue(currentProjectPage.IsSelected, prefix + " - Project page is not selected after opening project");

                // Check that File - close has been enabled
                var fileCloseMenu = MenuProxies.GetFileCloseMenuItem(application, log);
                assert.IsTrue(fileCloseMenu.Enabled, prefix + " - File - Close menu is not enabled");

                // HACK: It seems that the File menu stays open when we check the File - close menu item
                var fileMenu = MenuProxies.GetFileMenuItem(application, log);
                if (fileMenu == null)
                {
                    var message = "Failed to get the file menu.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                if (fileMenu.IsFocussed)
                {
                    fileMenu.Click();
                }

                // Close the project via the close button on the tab page
                TabProxies.CloseProjectPageTab(application, log);

                WelcomePageControlProxies.CheckCloseWelcomePageOnProjectOpen(application, log);

                // New button
                newProjectButton.Click();

                // Check that the start page has been closed
                currentStartPage = TabProxies.GetStartPageTabItem(application, log);
                assert.IsNull(currentStartPage, prefix + " - Start page exists after opening project");

                // Close the project via the close button on the tab page
                TabProxies.CloseProjectPageTab(application, log);
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
Пример #2
0
 public void CheckContentTypes()
 {
     Assert.IsFalse(package.PartExists(new Uri("[Content_Types].xml", UriKind.Relative)));
 }
Пример #3
0
        public void TripleStoreHasGraph01()
        {
            ITripleStore store = this.GetInstance();

            Assert.IsFalse(store.HasGraph(new Uri("http://thereisnosuchdomain.com/graph")));
        }
Пример #4
0
 public void ServiceInteropUsedByDefault()
 {
     // Test initialie does load CosmosClient
     Assert.IsFalse(CustomTypeExtensions.ByPassQueryParsing());
 }
Пример #5
0
 virtual public void VerifyPipelineContentNotCalledOnNoTag() {
     worker.Text("test");
     Assert.IsFalse(called);
 }
Пример #6
0
 public void DeepEquals()
 {
     Assert.IsTrue(JToken.DeepEquals(new JValue(5L), new JValue(5)));
     Assert.IsFalse(JToken.DeepEquals(new JValue(5M), new JValue(5)));
     Assert.IsTrue(JToken.DeepEquals(new JValue((ulong)long.MaxValue), new JValue(long.MaxValue)));
 }
Пример #7
0
        public void IsValid_InvalidId_IsFalse()
        {
            var result = ToxId.IsValid(this.invalidTestId);

            Assert.IsFalse(result);
        }
Пример #8
0
 public void Equals_TestStructObject_IsFalse()
 {
     Assert.IsFalse(CryptographicSeedTest.TestStruct.Equals(new object()));
 }
Пример #9
0
        public void PalindromeInvalidString(string value)
        {
            var isPalindrome = PalindromeValidator.IsStringPalindrome(value);

            Assert.IsFalse(isPalindrome);
        }
Пример #10
0
        public void IsValid_InvalidIdString_IsFalse()
        {
            var result = ToxId.IsValid(ToxTools.HexBinToString(this.invalidTestId));

            Assert.IsFalse(result);
        }
Пример #11
0
        public void VerifyIsLiveModeEnabledWithDefaultConfig()
        {
            var config = ConfigManager.GetConfigWithDefaults(null);

            Assert.IsFalse(ConfigManager.IsLiveModeEnabled(config));
        }
Пример #12
0
 public void RightNull()
 {
     var vector3D1 = new Vector3D();
     const Vector3D vector3D2 = null;
     Assert.IsFalse(vector3D1 == vector3D2);
 }
Пример #13
0
 public void the_subscription_gets_no_events()
 {
     Assert.IsFalse(_resetEvent.WaitOne(TimeSpan.FromSeconds(1)));
 }
Пример #14
0
 public void Equals_EmptyTestStruct_IsFalse()
 {
     Assert.IsFalse(CryptographicSeed.Empty.Equals(CryptographicSeedTest.TestStruct));
 }
Пример #15
0
		public void Send_Complete_ClientHandlerSettings ()
		{
			bool? failed = null;
			
			var listener = CreateListener (l => {
				var request = l.Request;
				
				try {
					Assert.IsNull (request.AcceptTypes, "#1");
					Assert.AreEqual (0, request.ContentLength64, "#2");
					Assert.IsNull (request.ContentType, "#3");
					Assert.AreEqual (1, request.Cookies.Count, "#4");
					Assert.AreEqual (new Cookie ("mycookie", "vv"), request.Cookies[0], "#4a");
					Assert.IsFalse (request.HasEntityBody, "#5");
					Assert.AreEqual (4, request.Headers.Count, "#6");
					Assert.AreEqual (TestHost, request.Headers["Host"], "#6a");
					Assert.AreEqual ("gzip", request.Headers["Accept-Encoding"], "#6b");
					Assert.AreEqual ("mycookie=vv", request.Headers["Cookie"], "#6c");
					Assert.AreEqual ("GET", request.HttpMethod, "#7");
					Assert.IsFalse (request.IsAuthenticated, "#8");
					Assert.IsTrue (request.IsLocal, "#9");
					Assert.IsFalse (request.IsSecureConnection, "#10");
					Assert.IsFalse (request.IsWebSocketRequest, "#11");
					Assert.IsTrue (request.KeepAlive, "#12");
					Assert.AreEqual (HttpVersion.Version10, request.ProtocolVersion, "#13");
					Assert.IsNull (request.ServiceName, "#14");
					Assert.IsNull (request.UrlReferrer, "#15");
					Assert.IsNull (request.UserAgent, "#16");
					Assert.IsNull (request.UserLanguages, "#17");
					failed = false;
				} catch {
					failed = true;
				}
			});

			try {
				var chandler = new HttpClientHandler ();
				chandler.AllowAutoRedirect = true;
				chandler.AutomaticDecompression = DecompressionMethods.GZip;
				chandler.MaxAutomaticRedirections = 33;
				chandler.MaxRequestContentBufferSize = 5555;
				chandler.PreAuthenticate = true;
				chandler.CookieContainer.Add (new Uri (LocalServer), new Cookie ( "mycookie", "vv"));
				chandler.UseCookies = true;
				chandler.UseDefaultCredentials = true;
				chandler.Proxy = new WebProxy ("ee");
				chandler.UseProxy = true;

				var client = new HttpClient (chandler);
				var request = new HttpRequestMessage (HttpMethod.Get, LocalServer);
				request.Version = HttpVersion.Version10;
				request.Headers.Add ("Keep-Alive", "false");
				var response = client.SendAsync (request, HttpCompletionOption.ResponseHeadersRead).Result;

				Assert.AreEqual ("", response.Content.ReadAsStringAsync ().Result, "#100");
				Assert.AreEqual (HttpStatusCode.OK, response.StatusCode, "#101");
				Assert.AreEqual (false, failed, "#102");
			} finally {
				listener.Abort ();
				listener.Close ();
			}
		}
Пример #16
0
 public void Equals_TestStructNull_IsFalse()
 {
     Assert.IsFalse(CryptographicSeedTest.TestStruct.Equals(null));
 }
 public void TestAddessIsEmptyReturnsFalseWhenNotEmpty()
 {
     var customerWithAddress = new Customer();
     customerWithAddress.AddAddress(new Address());
     Assert.IsFalse(customerWithAddress.AddressesIsEmpty());
 }
Пример #18
0
 public void IsValid_Data_IsFalse()
 {
     Assert.IsFalse(CryptographicSeed.IsValid("!"), "!");
     Assert.IsFalse(CryptographicSeed.IsValid((String)null), "(String)null");
     Assert.IsFalse(CryptographicSeed.IsValid(string.Empty), "string.Empty");
 }
Пример #19
0
 public void file_Has_Attribute()
 {
     //readOnly_Add();
     Assert.IsFalse((null as string).file_Has_Attribute(FileAttributes.Archive));
 }
Пример #20
0
        public async Task Telemetry_NoPII()
        {
            // Arrange
            var         mockTelemetryClient = new Mock <IBotTelemetryClient>();
            TestAdapter adapter             = new TestAdapter()
                                              .Use(new TelemetryLoggerMiddleware(mockTelemetryClient.Object, logPersonalInformation: false));
            string conversationId = null;

            // Act
            // Ensure LogPersonalInformation flag works
            await new TestFlow(adapter, async(context, cancellationToken) =>
            {
                conversationId     = context.Activity.Conversation.Id;
                var typingActivity = new Activity
                {
                    Type      = ActivityTypes.Typing,
                    RelatesTo = context.Activity.RelatesTo
                };
                await context.SendActivityAsync(typingActivity);
                await Task.Delay(500);
                await context.SendActivityAsync("echo:" + context.Activity.Text);
            })
            .Send("foo")
            .AssertReply((activity) => Assert.AreEqual(activity.Type, ActivityTypes.Typing))
            .AssertReply("echo:foo")
            .Send("bar")
            .AssertReply((activity) => Assert.AreEqual(activity.Type, ActivityTypes.Typing))
            .AssertReply("echo:bar")
            .StartTestAsync();

            // Assert
            Assert.AreEqual(mockTelemetryClient.Invocations.Count, 6);
            Assert.AreEqual(mockTelemetryClient.Invocations[0].Arguments[0], "BotMessageReceived"); // Check initial message
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).Count == 5);
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("fromId"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("conversationName"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("locale"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("recipientId"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("recipientName"));
            Assert.IsFalse(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("fromName"));
            Assert.IsFalse(((Dictionary <string, string>)mockTelemetryClient.Invocations[0].Arguments[1]).ContainsKey("text"));

            Assert.AreEqual(mockTelemetryClient.Invocations[1].Arguments[0], "BotMessageSend"); // Check Typing message
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[1].Arguments[1]).Count == 4);
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[1].Arguments[1]).ContainsKey("replyActivityId"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[1].Arguments[1]).ContainsKey("recipientId"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[1].Arguments[1]).ContainsKey("conversationName"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[1].Arguments[1]).ContainsKey("locale"));
            Assert.IsFalse(((Dictionary <string, string>)mockTelemetryClient.Invocations[1].Arguments[1]).ContainsKey("recipientName"));

            Assert.AreEqual(mockTelemetryClient.Invocations[2].Arguments[0], "BotMessageSend"); // Check message reply
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[2].Arguments[1]).Count == 4);
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[2].Arguments[1]).ContainsKey("replyActivityId"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[2].Arguments[1]).ContainsKey("recipientId"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[2].Arguments[1]).ContainsKey("conversationName"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[2].Arguments[1]).ContainsKey("locale"));
            Assert.IsFalse(((Dictionary <string, string>)mockTelemetryClient.Invocations[2].Arguments[1]).ContainsKey("recipientName"));
            Assert.IsFalse(((Dictionary <string, string>)mockTelemetryClient.Invocations[2].Arguments[1]).ContainsKey("text"));

            Assert.AreEqual(mockTelemetryClient.Invocations[3].Arguments[0], "BotMessageReceived"); // Check bar message
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[3].Arguments[1]).Count == 5);
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[3].Arguments[1]).ContainsKey("fromId"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[3].Arguments[1]).ContainsKey("conversationName"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[3].Arguments[1]).ContainsKey("locale"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[3].Arguments[1]).ContainsKey("recipientId"));
            Assert.IsTrue(((Dictionary <string, string>)mockTelemetryClient.Invocations[3].Arguments[1]).ContainsKey("recipientName"));
            Assert.IsFalse(((Dictionary <string, string>)mockTelemetryClient.Invocations[3].Arguments[1]).ContainsKey("fromName"));
            Assert.IsFalse(((Dictionary <string, string>)mockTelemetryClient.Invocations[3].Arguments[1]).ContainsKey("text"));
        }
Пример #21
0
 private void AssertNoIPInDB()
 {
     Assert.IsFalse(service.DB.TryGetIPAddress(ip1, out _));
     Assert.IsFalse(service.DB.TryGetIPAddress(ip2, out _));
 }
Пример #22
0
 public void HasValues()
 {
     Assert.IsFalse((new JValue(5L)).HasValues);
 }
    // ~~

    void ContainsOneElementTest()
    {
        List< TEST >
            test_table,
            test1_table,
            test2_table,
            empty_table;
        TEST
            test0,
            test1,
            test2,
            test3,
            test4,
            test5,
            test6,
            test7,
            test8,
            test9,
            test10;

        test0 = new TEST{ Index = 0 };
        test1 = new TEST{ Index = 1 };
        test2 = new TEST{ Index = 2 };
        test3 = new TEST{ Index = 3 };
        test4 = new TEST{ Index = 4 };
        test5 = new TEST{ Index = 5 };
        test6 = new TEST{ Index = 6 };
        test7 = new TEST{ Index = 7 };
        test8 = new TEST{ Index = 8 };
        test9 = new TEST{ Index = 9 };
        test10 = new TEST{ Index = 10 };

        test_table = new List<TEST>( 
            new TEST[]
            { 
                test0,
                test1,
                test2,
                test3,
                test4,
                test5
            }
        );

        test1_table = new List<TEST>( 
            new TEST[]
            { 
                test5,
                test6,
                test7,
                test8,
            }
        );

        test2_table = new List<TEST>( 
            new TEST[]
            { 
                test9,
                test10
            }
        );

        empty_table = new List<TEST>();

        Assert.IsTrue( test_table.ContainsOneElement( test1_table ) );
        Assert.IsFalse( test1_table.ContainsOneElement( test2_table ) );
        Assert.IsFalse( test1_table.ContainsOneElement( empty_table ) );
    }
Пример #24
0
 public void HLEmailValidator_shouldBeInvalidEmail(string input)
 {
     Assert.IsFalse(HLEmailValidator.IsValidEmail(input));
 }
Пример #25
0
        public static Polygons GetExtrusionPolygonsForLayer(this string[] layerGCode, ref MovementInfo movementInfo, bool validateOverlaps = true)
        {
            var foundPolygons = new Polygons();

            bool         extruding        = false;
            int          movementCount    = 0;
            double       movementAmount   = double.MaxValue / 2;     // always add a new extrusion the first time
            MovementInfo lastMovement     = movementInfo;
            MovementInfo lastLastMovement = movementInfo;

            foreach (MovementInfo currentMovement in TestUtilities.GetLayerMovements(layerGCode, lastMovement))
            {
                bool isRetraction = currentMovement.extrusion != lastMovement.extrusion && (currentMovement.position == lastLastMovement.position);
                bool isZLift      = currentMovement.position.x == lastLastMovement.position.x && currentMovement.position.y == lastLastMovement.position.y && currentMovement.position.z != lastLastMovement.position.z;
                bool isExtrude    = !isRetraction && !isZLift && currentMovement.extrusion != lastMovement.extrusion;

                if (extruding)
                {
                    if (isExtrude)
                    {
                        // add to the extrusion
                        foundPolygons[foundPolygons.Count - 1].Add(new IntPoint(
                                                                       (long)(currentMovement.position.x * 1000),
                                                                       (long)(currentMovement.position.y * 1000),
                                                                       (long)(currentMovement.position.z * 1000)));
                    }
                    else
                    {
                        // we are switching so add in the point to the last extrude
                        extruding      = false;
                        movementAmount = 0;
                        if (foundPolygons[foundPolygons.Count - 1].Count == 1)
                        {
                            foundPolygons[foundPolygons.Count - 1].Add(new IntPoint(
                                                                           (long)(lastLastMovement.position.x * 1000),
                                                                           (long)(lastLastMovement.position.y * 1000),
                                                                           (long)(lastLastMovement.position.z * 1000)));
                        }
                    }
                }
                else                 // not extruding
                {
                    if (isExtrude)
                    {
                        if (movementAmount >= 0)
                        {
                            // starting a new extrusion
                            foundPolygons.Add(new Polygon());
                        }

                        foundPolygons[foundPolygons.Count - 1].Add(new IntPoint(
                                                                       (long)(currentMovement.position.x * 1000),
                                                                       (long)(currentMovement.position.y * 1000),
                                                                       (long)(currentMovement.position.z * 1000)));
                        extruding = true;
                    }
                    else                     // do nothing waiting for extrude
                    {
                        movementAmount += (currentMovement.position - lastMovement.position).Length;
                    }
                }

                lastLastMovement = lastMovement;
                lastMovement     = currentMovement;
                movementCount++;
            }

            for (int i = foundPolygons.Count - 1; i >= 0; i--)
            {
                if (!extruding && foundPolygons[i].Count == 1)
                {
                    foundPolygons.RemoveAt(i);
                }
                else if (foundPolygons[foundPolygons.Count - 1].Count == 1)
                {
                    foundPolygons[foundPolygons.Count - 1].Add(new IntPoint(
                                                                   (long)(lastLastMovement.position.x * 1000),
                                                                   (long)(lastLastMovement.position.y * 1000),
                                                                   (long)(lastLastMovement.position.z * 1000)));
                    break;
                }
            }

            movementInfo = lastMovement;

            // validate that the polygons do not double extrude
            if (validateOverlaps)
            {
                Assert.IsFalse(HasOverlapingSegments(foundPolygons));
            }

            return(foundPolygons);
        }
Пример #26
0
        private TestResult VerifyTabBehaviour(Application application, Log log)
        {
            const string prefix = "Tabs";
            var result = new TestResult();
            var assert = new Assert(result, log);
            try
            {
                var startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    log.Info(prefix, "Opening start page.");
                    MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);
                }

                // Make sure we don't close the welcome tab upon opening the project page
                WelcomePageControlProxies.UncheckCloseWelcomePageOnProjectOpen(application, log);

                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    log.Info(prefix, "Opening project page.");
                    WelcomePageControlProxies.OpenProjectPageViaWelcomePageButton(application, log);
                }

                startPage = TabProxies.GetStartPageTabItem(application, log);
                if (startPage == null)
                {
                    var message = "Failed to open the start page.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    var message = "Failed to open the project page.";
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);
                    return result;
                }

                try
                {
                    if (!startPage.IsSelected)
                    {
                        log.Info(prefix, "Setting focus to start page.");
                        startPage.Select();
                    }
                }
                catch (Exception e)
                {
                    var message = string.Format(
                        CultureInfo.InvariantCulture,
                        "Failed to select the start page tab. Error was: {0}",
                        e);
                    log.Error(prefix, message);
                    result.AddError(prefix + " - " + message);

                    return result;
                }

                assert.IsTrue(startPage.IsSelected, prefix + " - Start is selected");
                assert.IsFalse(projectPage.IsSelected, prefix + " - Project is not selected");

                MenuProxies.SwitchToProjectPageViaViewStartPageMenuItem(application, log);
                assert.IsFalse(startPage.IsSelected, prefix + " - Start is not selected");
                assert.IsTrue(projectPage.IsSelected, prefix + " - Project is selected");

                MenuProxies.SwitchToStartPageViaViewStartPageMenuItem(application, log);
                assert.IsTrue(startPage.IsSelected, prefix + " - Start is selected");
                assert.IsFalse(projectPage.IsSelected, prefix + " - Project is not selected");

                TabProxies.CloseProjectPageTab(application, log);
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
Пример #27
0
 public void Equals_TestStructEmpty_IsFalse()
 {
     Assert.IsFalse(CryptographicSeedTest.TestStruct.Equals(CryptographicSeed.Empty));
 }
Пример #28
0
        private TestResult VerifyActivateDataset(Application application, Log log)
        {
            const string prefix = "Dataset activation";
            var result = new TestResult();
            var assert = new Assert(result, log);
            try
            {
                // Start new project via File menu
                var projectPage = TabProxies.GetProjectPageTabItem(application, log);
                if (projectPage == null)
                {
                    MenuProxies.CreateNewProjectViaFileNewMenuItem(application, log);
                }

                projectPage = TabProxies.GetProjectPageTabItem(application, log);
                assert.IsNotNull(projectPage, prefix + " - The project page was not opened.");

                ProjectPageControlProxies.CreateChildDatasetForRoot(application, log);
                ProjectPageControlProxies.CreateChildDatasetForRoot(application, log);

                // Wait for datasets to be created
                ProjectPageControlProxies.WaitForDatasetCreationOrDeletion(application, log, 3);

                var datasetIds = ProjectPageControlProxies.GetDatasetIds(application, log);
                var ids = new List<int>(datasetIds);
                ids.Sort();

                ProjectPageControlProxies.ActivateDataset(application, log, ids[1]);

                var isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsTrue(isDataset1Activated, prefix + " - Failed to activate the first dataset.");

                var isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsFalse(isDataset2Activated, prefix + " - Activated the second dataset while it should not have been.");

                ProjectPageControlProxies.ActivateDataset(application, log, ids[2]);

                isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsTrue(isDataset1Activated, prefix + " - Deactivated the first dataset when it should not have been.");

                isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsTrue(isDataset2Activated, prefix + " - Failed to activate the second dataset.");

                /*
                // Undo
                MenuProxies.UndoViaEditMenu(application, log);

                isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsTrue(isDataset1Activated, prefix + " - Deactivated the first dataset when it should not have been.");

                isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsFalse(isDataset2Activated, prefix + " - Did not undo the activation state of the second dataset.");

                // Undo
                MenuProxies.UndoViaEditMenu(application, log);

                isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsFalse(isDataset1Activated, prefix + " - Did not undo the activation state of the first dataset.");

                isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsFalse(isDataset2Activated, prefix + " - Still did not undo the activation state of the second dataset.");

                // Redo
                MenuProxies.RedoViaEditMenu(application, log);

                isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsTrue(isDataset1Activated, prefix + " - Did not redo the undone activation state of the first dataset.");

                isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsFalse(isDataset2Activated, prefix + " - Redid the activation state of the second dataset when it should not have been.");

                // Redo
                MenuProxies.RedoViaEditMenu(application, log);

                isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsTrue(isDataset1Activated, prefix + " - Changed the activation state of the first dataset when it should not have been.");

                isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsTrue(isDataset2Activated, prefix + " - Did not redo the undone activation state of the second dataset.");
                 * */

                ProjectPageControlProxies.DeactivateDataset(application, log, ids[1]);

                isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsFalse(isDataset1Activated, prefix + " - Failed to deactivate the first dataset.");

                isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsTrue(isDataset2Activated, prefix + " - Deactivated the second dataset when it should not have been.");

                ProjectPageControlProxies.DeactivateDataset(application, log, ids[2]);

                isDataset1Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[1]);
                assert.IsFalse(isDataset1Activated, prefix + " - Failed to deactivate the first dataset.");

                isDataset2Activated = ProjectPageControlProxies.IsDatasetActivated(application, log, ids[2]);
                assert.IsFalse(isDataset2Activated, prefix + " - Failed to deactivate the second dataset.");
            }
            catch (RegressionTestFailedException e)
            {
                var message = string.Format(
                    CultureInfo.InvariantCulture,
                    "Failed with exception. Error: {0}",
                    e);
                log.Error(prefix, message);
                result.AddError(prefix + " - " + message);
            }

            return result;
        }
Пример #29
0
        public virtual void TestUnsupportedOldIndexes()
        {
            for (int i = 0; i < UnsupportedNames.Length; i++)
            {
                if (VERBOSE)
                {
                    Console.WriteLine("TEST: index " + UnsupportedNames[i]);
                }
                DirectoryInfo oldIndexDir = CreateTempDir(UnsupportedNames[i]);
                using (Stream dataFile = this.GetType().GetTypeInfo().Assembly.FindAndGetManifestResourceStream(GetType(), "unsupported." + UnsupportedNames[i] + ".zip"))
                {
                    TestUtil.Unzip(dataFile, oldIndexDir);
                }
                BaseDirectoryWrapper dir = NewFSDirectory(oldIndexDir);
                // don't checkindex, these are intentionally not supported
                dir.CheckIndexOnDispose = false;

                IndexReader reader = null;
                IndexWriter writer = null;
                try
                {
                    reader = DirectoryReader.Open(dir);
                    Assert.Fail("DirectoryReader.open should not pass for " + UnsupportedNames[i]);
                }
#pragma warning disable 168
                catch (IndexFormatTooOldException e)
#pragma warning restore 168
                {
                    // pass
                }
                finally
                {
                    if (reader != null)
                    {
                        reader.Dispose();
                    }
                    reader = null;
                }

                try
                {
                    writer = new IndexWriter(dir, NewIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(Random)));
                    Assert.Fail("IndexWriter creation should not pass for " + UnsupportedNames[i]);
                }
                catch (IndexFormatTooOldException e)
                {
                    // pass
                    if (VERBOSE)
                    {
                        Console.WriteLine("TEST: got expected exc:");
                        Console.WriteLine(e.StackTrace);
                    }
                    // Make sure exc message includes a path=
                    Assert.IsTrue(e.Message.IndexOf("path=\"", StringComparison.Ordinal) != -1, "got exc message: " + e.Message);
                }
                finally
                {
                    // we should fail to open IW, and so it should be null when we get here.
                    // However, if the test fails (i.e., IW did not fail on open), we need
                    // to close IW. However, if merges are run, IW may throw
                    // IndexFormatTooOldException, and we don't want to mask the Assert.Fail()
                    // above, so close without waiting for merges.
                    if (writer != null)
                    {
                        writer.Dispose(false);
                    }
                    writer = null;
                }

                StringBuilder bos     = new StringBuilder();
                CheckIndex    checker = new CheckIndex(dir);
                checker.InfoStream = new StringWriter(bos);
                CheckIndex.Status indexStatus = checker.DoCheckIndex();
                Assert.IsFalse(indexStatus.Clean);
                checker.InfoStream.Flush();
                Assert.IsTrue(bos.ToString().Contains(typeof(IndexFormatTooOldException).Name));

                dir.Dispose();
            }
        }