Ejemplo n.º 1
0
        public void Test_that_the_asset_image_is_displayed()
        {
            var path = Common.PathTo01FestoAasx();

            Common.RunWithMainWindow((application, automation, mainWindow) =>
            {
                Common.AssertLoadAasx(application, mainWindow, path);
                Common.AssertNoErrors(application, mainWindow);

                const string automationId = "AssetPic";

                var assetPic = Retry.Find(
                    () => mainWindow.FindFirstChild(cf => cf.ByAutomationId(automationId)),
                    new RetrySettings {
                    ThrowOnTimeout = true, Timeout = TimeSpan.FromSeconds(5)
                });

                Assert.IsNotNull(assetPic, $"Could not find the element: {automationId}");

                // The dimensions of the image will not be set properly if the image could not be loaded.
                if (assetPic.BoundingRectangle.Height <= 1 ||
                    assetPic.BoundingRectangle.Width <= 1)
                {
                    throw new AssertionException(
                        "The asset picture has unexpected dimensions: " +
                        $"width is {assetPic.BoundingRectangle.Width} and " +
                        $"height is {assetPic.BoundingRectangle.Height}");
                }
            });
        }
Ejemplo n.º 2
0
            public void ShouldImportPagesRecursively()
            {
                const string PAGE_NAME = "Child Page";

                var childPage = new Page {
                    InternalName = PAGE_NAME
                };
                var parentPage = new Page {
                    InternalName = "Parent Page"
                };
                var grandparentPage = new Page {
                    InternalName = "Grandparent Page"
                };

                parentPage.Pages.Add(childPage);
                grandparentPage.Pages.Add(parentPage);

                var json       = grandparentPage.ToJson();
                var page       = Page.FromJson(json);
                var childPages = page.Pages.First().Pages;

                Assert.IsNotNull(childPages);
                Assert.IsNotEmpty(childPages);
                Assert.AreEqual(childPages.First().InternalName, PAGE_NAME);
            }
        public void EmployeeDetailsViewReturnsSingleEmployeeModel()
        {
            //Arrange
            var mock = new Mock <IEmployeeRepository>();

            mock.Setup(e => e.Employees).Returns(new[]
            {
                new Employee {
                    Id = 5, Name = "DD", ManagerId = 4
                }
            }.AsQueryable());

            var controller = new EmployeeController(mock.Object);

            //Act
            if (!(controller.Details(5) is ViewResult actual))
            {
                return;
            }
            var model = actual.Model as Employee;

            //Assert
            Assert.IsNotNull(actual);
            Assert.IsNotNull(model);
            Assert.AreEqual(5, model.Id);
        }
Ejemplo n.º 4
0
        public void Test01_FindEvent()
        {
            // Navigate to New Event Page
            Thread.Sleep(TimeSpan.FromSeconds(1));
            Session.FindElementByName("Month").Click();

            // Find the event created before
            WindowsElement eventName = Session.FindElementByAccessibilityId("Day_2019-08-14T00:00:00Z");

            eventName.Click();

            // Click and verify Agenda Appointment
            WindowsElement agendaAppointment = Session.FindElementByClassName("AgendaAppointment");

            agendaAppointment.Click();
            Assert.IsNotNull(agendaAppointment.Text);

            // Click Cancel button
            Session.FindElementByName("Cancel").Click();

            // Enter cancellation message
            Session.FindElementByAccessibilityId("CancellationMessageTextBox").SendKeys(CancellationMessage);

            // Send cancellation
            Session.FindElementByAccessibilityId("x_sendCancellationButton").Click();

            // Verify event name is empty
            Session.FindElementByAccessibilityId("Day_2019-08-14T00:00:00Z").Click();
            WindowsElement eventDate = Session.FindElementByName("Event name");

            Assert.IsTrue(eventDate.Text.Contains(" "));
        }
Ejemplo n.º 5
0
        public void Should_ReturnDoctor_When_Get()
        {
            var result = _doctorsController.Get(1);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Id);
        }
        public void TestSeason()
        {
            const int    year   = 2016;
            const string season = "Spring";

            var httpMock = HttpMockRepository.At("http://*****:*****@"http://localhost:8082/anime/season/{0}/{1}");

            var instance = new SeasonRetriever(fakeFactory, fakeSeasonLookup, fakeUrlHelper);
            var result   = instance.GetSeasonData(year, season).Result;

            Assert.AreEqual(result.Count, 78);
            var first = result.FirstOrDefault();

            Assert.IsNotNull(first);
            Assert.AreEqual(first.Id, 31737);
            Assert.AreEqual(first.Title, "Gakusen Toshi Asterisk 2nd Season");
        }
 public void testSearchingMethod()
 {
     _usersPageViewModel.SearchCommand.Execute("Juli");
     Assert.IsNotNull(_usersPageViewModel.FilteredUsers);
     Assert.AreEqual(2, _usersPageViewModel.FilteredUsers.Count);
     Assert.IsTrue(_usersPageViewModel.FilteredUsers.Any(user => user.FirstName == "Julianna"));
 }
Ejemplo n.º 8
0
        public void SubscribeToStackNotNull()
        {
            IObserver <Message> observer = new ObserverMock();
            IDisposable         disposableMessageStack = membre.SubscribeToStack(observer, ami.id);

            Assert.IsNotNull(disposableMessageStack);
        }
Ejemplo n.º 9
0
        public void TestInvalidID()
        {
            string html = @"<img alt="""" id=""Picture 7"" src=""Image.aspx?imageId=26381""
                style=""border-top-width: 1px; border-right-width: 1px; border-bottom-width:
                1px; border-left-width: 1px; border-top-style: solid; border-right-style:
                solid; border-bottom-style: solid; border-left-style: solid; margin-left:
                1px; margin-right: 1px; width: 950px; height: 451px; "" />";

            var dom = CQ.Create(html);
            var res = dom["img"];

            Assert.AreEqual(1, res.Length);
            Assert.AreEqual("Picture 7", res[0].Id);

            var img = dom.Document.GetElementById("Picture 7");

            Assert.IsNotNull(img);
            Assert.AreEqual("Picture 7", img.Id);

            img = dom.Document.GetElementById("Picture");
            Assert.IsNull(img);

            dom = CQ.Create("<body><div></div><img id=\"image test\" src=\"url\"/>content</div></body>");
            res = dom["img"];
            Assert.AreEqual(1, res.Length);
            Assert.AreEqual("image test", res[0].Id);
        }
Ejemplo n.º 10
0
        public void GetPasswords()
        {
            DataBase dataBase = new DataBase();
            var      dane     = dataBase.GetPasswords(filePath);

            Assert.IsNotNull(dane);
        }
Ejemplo n.º 11
0
        public void CacheIsAvailable()
        {
            var builder = new TestControllerBuilder();

            Assert.IsNotNull(builder.HttpContext.Cache);

            var controller = new TestHelperController();

            builder.InitializeController(controller);

            Assert.IsNotNull(controller.HttpContext.Cache);

            string testKey   = "TestKey";
            string testValue = "TestValue";

            controller.HttpContext.Cache.Add(testKey,
                                             testValue,
                                             null,
                                             DateTime.Now.AddSeconds(1),
                                             Cache.NoSlidingExpiration,
                                             CacheItemPriority.Normal,
                                             null);

            Assert.AreEqual(testValue,
                            controller.HttpContext.Cache[testKey]);
        }
Ejemplo n.º 12
0
        public void ChangeValue()
        {
            DataBase dataBase = new DataBase();
            string   result   = dataBase.ChangeValues("tytul", filePath, "user", "pass", "http://google.com", "Opis ogolnie");

            Assert.IsNotNull(result);
        }
Ejemplo n.º 13
0
        public void TestNotificationIdPersistence()
        {
            // arrange
            iServer.SetDesiredResponse(iServerResponseV1);
            var waitHandle = new AutoResetEvent(false);

            iView.ShowCallback = (notification, shownow) =>
            {
                notification.Closed(false);
                waitHandle.Set();
            };

            // act
            using (var controller = new NotificationController(iInvoker, iPersistence, iServer, iView, NotificationController.DefaultTimespan))
            {
                Assert.That(waitHandle.WaitOne(kTimeoutMilliseconds));
            }

            // flush pending invocations
            AwaitInvoker();

            // assert
            Assert.IsNotNull(iView.Current);
            Assert.IsNotNull(iView.LastShown);
            Assert.AreEqual(iView.Current, iView.LastShown);
            Assert.AreEqual(iPersistence.LastNotificationVersion, 1);
            Assert.AreEqual(iNotificationVersion1.Uri, iView.Current.Uri(false));
            Assert.AreEqual(iNotificationVersion1.Version, iView.Current.Version);
        }
Ejemplo n.º 14
0
        public void TestNotificationIsNotShownIfAlreadySeen()
        {
            // arrange
            iPersistence.LastNotificationVersion = 1;
            iPersistence.LastShownNotification   = DateTime.Now;
            iServer.SetDesiredResponse(iServerResponseV1);
            var waitHandle = new AutoResetEvent(false);

            iView.ShowCallback = (notification, shownow) =>
            {
                if (shownow)
                {
                    Assert.Fail("View should not be shown.");
                }
                waitHandle.Set();
            };

            // act
            using (var controller = new NotificationController(iInvoker, iPersistence, iServer, iView, NotificationController.DefaultTimespan))
            {
                Assert.That(waitHandle.WaitOne(kTimeoutMilliseconds));
            }

            // flush pending invocations
            AwaitInvoker();

            // assert
            Assert.IsNotNull(iView.Current);
            Assert.IsNull(iView.LastShown);
            Assert.AreEqual(iPersistence.LastNotificationVersion, iNotificationVersion1.Version);
        }
Ejemplo n.º 15
0
        public void GIVEN_Dart_WHEN_stationFinder_is_called_TEHN_should_return_correct_response()
        {
            //Arrange
            var result = GetValidResult();

            _dataAccess.Setup(x => x.GetStationList()).Returns(result);
            _dataAccess.Setup(x => x.GetName(It.IsAny <string>())).ReturnsAsync("testgetname");

            //Act
            var response = _stationFinder.GetSuggestions("Dart");

            _suggestions.NextLetters = new HashSet <string>()
            {
                "F", "M"
            };
            _suggestions.Stations = new HashSet <string>()
            {
                "DARTFORD", "DARTMOUTH"
            };

            //Assert
            Assert.IsNotNull(response);
            Assert.AreEqual(response.Result.NextLetters.Count, 2);
            Assert.AreEqual(response.Result.Stations.Count, 2);
            Assert.AreEqual(response.Result.NextLetters, _suggestions.NextLetters);
            Assert.AreEqual(response.Result.Stations, _suggestions.Stations);
        }
Ejemplo n.º 16
0
        public void TestSetUserAsMainForSecondDeveloper()
        {
            TelimenaUserManager manager = new TelimenaUserManager(new UserStore <TelimenaUser>(this.Context));
            AccountUnitOfWork   unit    = new AccountUnitOfWork(null, manager, this.Context);

            GetTwoUsers(unit);

            TelimenaUser jim  = unit.UserManager.FindByNameAsync(Helpers.GetName("*****@*****.**")).GetAwaiter().GetResult();
            TelimenaUser jack = unit.UserManager.FindByNameAsync(Helpers.GetName("*****@*****.**")).GetAwaiter().GetResult();

            DeveloperTeam jackDev = unit.DeveloperRepository.FirstOrDefault(x => x.MainUser.Id == jack.Id);
            DeveloperTeam jimDev  = unit.DeveloperRepository.FirstOrDefault(x => x.MainUser.Id == jim.Id);

            Assert.AreEqual(jackDev.Id, jack.GetDeveloperAccountsLedByUser().Single().Id);
            Assert.AreEqual(jimDev.Id, jim.GetDeveloperAccountsLedByUser().Single().Id);

            jimDev.SetMainUser(jack);
            unit.Complete();

            Assert.IsNotNull(jimDev.AssociatedUsers.Single(x => x.Id == jim.Id));
            Assert.IsNotNull(jimDev.AssociatedUsers.Single(x => x.Id == jack.Id));

            Assert.AreEqual(1, jim.AssociatedDeveloperAccounts.Count());
            Assert.AreEqual(jack, jimDev.MainUser);

            Assert.AreEqual(0, jim.GetDeveloperAccountsLedByUser().Count());
            Assert.AreEqual(2, jack.GetDeveloperAccountsLedByUser().Count());

            Assert.IsNotNull(jack.GetDeveloperAccountsLedByUser().Single(x => x.Id == jackDev.Id));
            Assert.IsNotNull(jack.GetDeveloperAccountsLedByUser().Single(x => x.Id == jimDev.Id));
        }
Ejemplo n.º 17
0
        public void TestStationFinderDartford()
        {
            //Arrange
            var result = GetValidResult();

            _dataAccess.Setup(x => x.GetStationList()).Returns(result);
            _dataAccess.Setup(x => x.GetName(It.IsAny <string>())).ReturnsAsync("testgetname");

            //Act
            Suggestions response = _stationFinder.GetSuggestions("Dartford").Result;

            _suggestions.NextLetters = new HashSet <string>()
            {
            };
            _suggestions.Stations = new HashSet <string>()
            {
                "DARTFORD"
            };

            //Assert
            Assert.IsNotNull(response);
            Assert.AreEqual(response.NextLetters.Count, 0);
            Assert.AreEqual(response.Stations.Count, 1);
            Assert.AreEqual(response.NextLetters, _suggestions.NextLetters);
            Assert.AreEqual(response.Stations, _suggestions.Stations);
        }
        public void DevelopmentPlanIndexViewContainsListOfDevelopmentPlanModel()
        {
            //Arrange
            var mock = new Mock <IDevelopmentPlanRepository>();

            mock.Setup(d => d.DevelopmentPlans).Returns(new[]
            {
                new DevelopmentPlan {
                    Id = 1, EmployeeId = 2
                },
                new DevelopmentPlan {
                    Id = 2, EmployeeId = 4
                },
                new DevelopmentPlan {
                    Id = 3, EmployeeId = 1
                }
            }.AsQueryable());

            var controller = new DevelopmentPlanController(mock.Object);

            //Act
            var actual = (List <DevelopmentPlan>)controller.Index().Model;

            //Assert
            Assert.IsNotNull(actual);
            Assert.IsInstanceOf <List <DevelopmentPlan> >(actual);
        }
Ejemplo n.º 19
0
        public void SessionInit()
        {
            var appPath = @"C:\\Users\\Alexandre.DESKTOP-2TBN4PM\\Desktop\\Appium-Android\\Appium-Android\\Appium-Android\\cinemark.apk";

            var appiumOptions = new AppiumOptions();

            appiumOptions.AddAdditionalCapability(MobileCapabilityType.DeviceName, "emulator-5554");
            appiumOptions.AddAdditionalCapability(AndroidMobileCapabilityType.AppPackage, "com.cinemark.debug");
            appiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformName, "Android");
            //appiumOptions.AddAdditionalCapability(MobileCapabilityType.PlatformVersion, "8.1");
            appiumOptions.AddAdditionalCapability(AndroidMobileCapabilityType.AppActivity, "com.cinemark.presentation.common.MainActivity");
            appiumOptions.AddAdditionalCapability(AndroidMobileCapabilityType.AutoGrantPermissions, true);
            //appiumOptions.AddAdditionalCapability("chromedriverExecutable", @"C:\driver\chromedriver.exe");
            appiumOptions.AddAdditionalCapability("allowSessionOverride", true);
            appiumOptions.AddAdditionalCapability(MobileCapabilityType.App, appPath);
            appiumOptions.AddAdditionalCapability("udid", "emulator-5554");
            appiumOptions.AddAdditionalCapability("automationName", "UiAutomator2");
            appiumOptions.AddAdditionalCapability(MobileCapabilityType.NoReset, false);

            appiumOptions.AddAdditionalCapability("gpsEnabled", true);
            appiumOptions.AddAdditionalCapability("unicodeKeyboard", true);
            appiumOptions.AddAdditionalCapability("resetKeyboard", true);


            _driver = new AndroidDriver <AndroidElement>(new Uri(Host), appiumOptions);

            Assert.IsNotNull(_driver.Context);

            _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
        }
        public void Should_convert()
        {
            ActionResult result    = new EmptyResult();
            var          converted = result.AssertResultIs <EmptyResult>();

            Assert.IsNotNull(converted);
        }
Ejemplo n.º 21
0
        public void StartServerTest()
        {
            TestInitialize();

            #region Act

            _aserv.StartServer();
            Thread.Sleep(5);
            _clientOne.ConnectToServer();
            Thread.Sleep(5);
            _clientTwo.ConnectToServer();
            Thread.Sleep(5);
            _clientThree.ConnectToServer();
            Thread.Sleep(5);

            _clientOne.SendResponse("ClientOne");
            Thread.Sleep(5);
            _clientTwo.SendResponse("ClientTwo");
            Thread.Sleep(5);
            _clientThree.SendResponse("ClientThree");

            #endregion

            #region Assert

            Thread.Sleep(5);
            Assert.IsNotNull(_aserv.ServerSocket);
            Assert.IsNotNull(_aserv.ClientSocket);
            Assert.IsNotEmpty(_aserv.MessageList);

            Thread.Sleep(5);
            _aserv.StopServer();

            #endregion
        }
        public void Should_convert_to_ViewResult()
        {
            ActionResult result    = new ViewResult();
            ViewResult   converted = result.AssertViewRendered();

            Assert.IsNotNull(converted);
        }
Ejemplo n.º 23
0
            public void ShouldImportBlockType()
            {
                var obj = new
                {
                    IsSystem            = true,
                    BlockTypeId         = 1,
                    Zone                = "TestZone",
                    Order               = 3,
                    Name                = "FooInstance",
                    OutputCacheDuration = 0,
                    BlockType           = new
                    {
                        IsSystem    = false,
                        Path        = "Test Path",
                        Name        = "Test Name",
                        Description = "Test desc"
                    }
                };

                var json      = obj.ToJson();
                var block     = Block.FromJson(json);
                var blockType = block.BlockType;

                Assert.IsNotNull(blockType);
                Assert.AreEqual(blockType.Name, obj.BlockType.Name);
            }
        public void Should_convert_to_RedirectToRouteResult()
        {
            ActionResult          result    = new RedirectToRouteResult(new RouteValueDictionary());
            RedirectToRouteResult converted = result.AssertActionRedirect();

            Assert.IsNotNull(converted);
        }
        public void checkAttributForTextComment()
        {
            var doc = new HtmlAgilityPack.HtmlDocument();

            doc.LoadHtml(@"<html><body><div id='foo'><span> some</span> text</div></body></html>");
            var       div       = doc.GetElementbyId("foo");
            int       count     = 0;
            Exception exception = null;

            foreach (var textNode in div.ChildNodes)
            {
                try
                {
                    textNode.Id = "1";
                    count++;
                }
                catch (Exception e)
                {
                    exception = e;
                }
            }

            Assert.AreEqual(count, 1);
            Assert.IsNotNull(exception);
        }
        public void Should_convert_to_HttpRedirectResult()
        {
            ActionResult   result    = new RedirectResult("http://mvccontrib.org");
            RedirectResult converted = result.AssertHttpRedirect();

            Assert.IsNotNull(converted);
        }
Ejemplo n.º 27
0
        private void AssertStronglyNamedAssembly(Type typeFromAssemblyToCheck)
        {
            Assert.IsNotNull(typeFromAssemblyToCheck, "Cannot determine assembly from null");
            var assembly = typeFromAssemblyToCheck.Assembly;

            StringAssert.DoesNotContain("PublicKeyToken=null", assembly.FullName, "Strongly named assembly should have a PublicKeyToken in fully qualified name");
        }
Ejemplo n.º 28
0
        public void TestStationFinderLiverpool()
        {
            //Arrange
            var result = GetValidResult();

            _dataAccess.Setup(x => x.GetStationList()).Returns(result);
            _dataAccess.Setup(x => x.GetName(It.IsAny <string>())).ReturnsAsync("testgetname");

            //Act
            Suggestions response = _stationFinder.GetSuggestions("Liverpool").Result;

            _suggestions.NextLetters = new HashSet <string>()
            {
                "L"
            };
            _suggestions.Stations = new HashSet <string>()
            {
                "LIVERPOOL LIME STREET"
            };

            //Assert
            Assert.IsNotNull(response);
            Assert.AreEqual(response.NextLetters.Count, 1);
            Assert.AreEqual(response.Stations.Count, 1);
            Assert.AreEqual(response.NextLetters, _suggestions.NextLetters);
            Assert.AreEqual(response.Stations, _suggestions.Stations);
        }
        public void Get_ReturnNullListIfEntityIsNotExist()
        {
            var repository = new Mock <IRepository <Team> >();
            var restClient = new Mock <IRestClient>();

            var entity = new List <Team>()
            {
            };

            var leagueResponse = new ResponseLeague()
            {
                Id   = 3,
                Name = "Test League",
            };

            var response = new RestResponse <ResponseLeague>()
            {
                Content    = JsonConvert.SerializeObject(leagueResponse),
                StatusCode = HttpStatusCode.OK
            };

            restClient.Setup(st => st.Execute(It.IsAny <RestRequest>())).Returns(() => response);
            repository.Setup(st => st.List()).Returns(() => entity);

            var service = new TeamService(restClient.Object, repository.Object);
            var result  = service.Get();

            Assert.IsNotNull(result);
            Assert.AreEqual(result.Count, 0);
        }
Ejemplo n.º 30
0
        public void ValidateAndExtract_Should_Succeed()
        {
            var emailContent = @"Hi Yvaine,
                                    Please create an expense claim for the below. Relevant details are marked up as
                                    requested...
                                    <expense><cost_centre>DEV002</cost_centre>
                                    <total>1024.01</total><payment_method>personal card</payment_method>
                                    </expense>
                                    Another One here.
                                    <expense><cost_centre>DEV001</cost_centre>
                                    <total>118</total><payment_method>cash</payment_method>
                                    </expense>
                                    From: Ivan Castle
                                    Sent: Friday, 16 February 2018 10:32 AM
                                    To: Antoine Lloyd <*****@*****.**>
                                    Subject: test
                                    Hi Antoine,
                                    Please create a reservation at the <vendor>Viaduct Steakhouse</vendor> our
                                    <description>development team’s project end celebration dinner</description> on
                                    <date>Tuesday 27 April 2017</date>. We expect to arrive around
                                    7.15pm. Approximately 12 people but I’ll confirm exact numbers closer to the day.
                                    Regards,
                                    Ivan";

            var response = _expenseManager.ValidateAndExtract(emailContent);

            Assert.IsNotNull(response);
            Assert.AreEqual(response.GetType(), typeof(ExpenseModel));
        }