Exemple #1
0
 public static void StartupSpotSharp(TestContext context)
 {
     // Ok, so.. turns out libspotify has issues shutting down/restart in the same process.
     // This means in order to test SpotSharp we will start and login to one instance at
     // the start of testing.
     spotSharp = new SpotSharp.SpotSharp(_spotifyApiKey);
 }
 public static void Initialize(TestContext context)
 {
     if(!Directory.Exists(Expected))
     {
         Directory.CreateDirectory(Expected);
     }
 }
        public static void MyClassInitialize(TestContext testContext)
        {
            int i;

            IrregList1.Add(new TimeSeriesValue { Date = BlobStartDate1, Value = 1.1 });
            RegList1.Add(new TimeSeriesValue{ Date=BlobStartDate1, Value=-500.0 });

            for(i=1; i<TimeStepCount1; i++)
            {
                IrregList1.Add(new TimeSeriesValue{
                        Date=IrregList1[i-1].Date.AddHours(Math.Sqrt(i)),
                        Value=IrregList1[i-1].Value + i/4 });
                RegList1.Add(new TimeSeriesValue{
                        Date=RegList1[i-1].Date.AddHours(3),
                        Value=i * 10 });
            }

            IrregList2.Add(new TimeSeriesValue { Date = BlobStartDate2, Value = 3.5 });
            RegList2.Add(new TimeSeriesValue { Date = BlobStartDate2.RoundMonthEnd(0), Value = -20.0 });

            for (i = 1; i < TimeStepCount2; i++)
            {
                IrregList2.Add(new TimeSeriesValue
                {
                    Date = IrregList2[i-1].Date.AddDays(i/2),
                    Value = IrregList2[i-1].Value * 1.222,
                });
                RegList2.Add(new TimeSeriesValue
                {
                    Date = RegList2[i-1].Date.AddMonthsByEnd(0, 1),
                    Value = 3.0
                });
            }
        }
        internal static TestUser GetUser(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
        {
            TestUser user = new TestUser
            {
                Id        = Convert.ToInt32(context.DataRow["Id"]),
                Login     = Convert.ToString(context.DataRow["Login"]),
                FirstName = Convert.ToString(context.DataRow["FirstName"]),
                LastName  = Convert.ToString(context.DataRow["LastName"]),
                Email     = Convert.ToString(context.DataRow["Email"]),
                Password  = Convert.ToString(context.DataRow["Password"]),
            };

            //if Activate is not checked, the column value will be null, not false
            if (context.DataRow["Activate"] != System.DBNull.Value)
            {
                user.Activate = Convert.ToBoolean(context.DataRow["Activate"]);
            }

            if (context.DataRow["Factors"] != null && !(context.DataRow["Factors"] is System.DBNull) && !string.IsNullOrEmpty((string)context.DataRow["Factors"]))
            {
                string        strFactors = (string)context.DataRow["Factors"];
                List <string> lstFactors = strFactors.Split(',').ToList <string>();
                user.Factors = lstFactors;
            }

            return(user);
        }
        public static void ClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
        {
            PtfTestClassBase.Initialize(context);

            // The time out length is 2000 milliseconds.
            timeout = TimeSpan.FromMilliseconds(2000);
        }
Exemple #6
0
 public static void MyClassInitialize(TestContext testContext)
 {
     if(Directory.Exists(directory) == false)
     {
         Directory.CreateDirectory(directory);
     }
 }
        public static void SetUp(TestContext context)
        {
            _unitOfWork = new UnitOfWork();
            _memberFactory = new MemberFactory();
            _gomeeFactory = new GomeeFactory();
            _targetFactory = new TargetFactory();
            _targetDecorator = new TargetDecorator(_targetFactory, _unitOfWork.TargetRepository);

            _member = _memberFactory.CreateMember(Guid.NewGuid().ToString());
            _gomee = _gomeeFactory.CreateGomee(_member);
            _targets = new List<Target>();

            using (var uow = new UnitOfWork())
            {
                uow.MemberRepository.Add(_member);
                uow.GomeeRepository.Add(_gomee);

                var count = new Random().Next(2, 5);
                for (var i = 0; i < count; i++)
                {
                    var target = _targetFactory.CreateGomeeTarget(_member, _gomee);
                    _targets.Add(target);
                    uow.TargetRepository.Add(target);
                }

                uow.PersistAll();
            }

            _loadedTargets = _targetDecorator.GetFor(_unitOfWork.GomeeRepository.Get(_gomee.Id));
        }
Exemple #8
0
        public static void InitWebdriver(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext tc)
        {
            ObjectRepository.config = new AppConfigReader();
            switch (ObjectRepository.config.GetBrowser())
            {
            case BrowserType.Firefox:
                ObjectRepository.driver = GetFirefoxDriver();
                break;

            case BrowserType.Chrome:
                ObjectRepository.driver = GetChromeDriver();
                break;

            //case BrowserType.IExplorer:
            //    ObjectRepository.driver = GetIExplorerDriver();
            //    break;
            default:
                throw new NoSuitableDriverFound("Driver Not Found : " + ObjectRepository.config.GetBrowser().ToString());
            }
            //NavigationHelper.NavigateToUrl(ObjectRepository.config.GetWebsite());
            //ObjectRepository.driver.Manage()
            //    .Timeouts()
            //    .SetPageLoadTimeout=(TimeSpan.FromSeconds(ObjectRepository.config.GetPageLoadTimeOut()));
            ObjectRepository.driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(ObjectRepository.config.GetElementLoadTimeOut());

            ObjectRepository.driver.Manage().Timeouts().ImplicitWait = (TimeSpan.FromSeconds(ObjectRepository.config.GetElementLoadTimeOut()));
        }
Exemple #9
0
#pragma warning disable IDE0060 // Remove unused parameter
        public static void ClassInit(TestContext context)
#pragma warning restore IDE0060 // Remove unused parameter
        {
            general = Config.GetSectionDictionary(ConfigSection.MagenicMaqs);
            Config.AddTestSettingValues("Log", "OnFail", "MagenicMaqs");
            Config.AddTestSettingValues("LogType", "txt", "MagenicMaqs");
        }
 public static void MyClassInitialize(TestContext testContext)
 {
     IConfigSource configSource = Helper.ConfigSource_EventStore_SqlExpress;
     application = AppRuntime.Create(configSource);
     application.Initialize += new System.EventHandler<AppInitEventArgs>(Helper.AppInit_EventStore_SqlExpress);
     application.Start();
 }
		public static void InitializeAssembly(TestContext ctx)
		{
			// Setup the test database based on setting in the
			// configuration file
			SqlDatabaseTestClass.TestService.DeployDatabaseProject();
			SqlDatabaseTestClass.TestService.GenerateData();
		}
        public static void SetUp(TestContext context)
        {
            _unitOfWork = new UnitOfWork();
            var memberFactory = new MemberFactory();

            _email = Guid.NewGuid().ToString();

            _decorator = new MemberDecorator(memberFactory, _unitOfWork.MemberRepository);

            _oldCount = _unitOfWork.MemberRepository.Count();
            _member = memberFactory.CreateMember(_email);
            _sameMember = memberFactory.CreateMember(_email);

            _decorator.Add(_member);
            _unitOfWork.PersistAll();

            using (var uow = new UnitOfWork())
            {
                _newCount = uow.MemberRepository.Count();
                try
                {
                    _loadedMember = uow.MemberRepository.Get(_member.Id);
                }
                catch (Exception)
                {
                    _loadedMember = null;
                }
            }
        }
        public JarChecker(TestContext testContext, string fullJarPath)
        {
            TestUtils.AssertFileExists(fullJarPath);

            this.unzippedDir = TestUtils.CreateTestDirectory(testContext, "unzipped");
            ZipFile.ExtractToDirectory(fullJarPath, this.unzippedDir);
        }
 public static void MyClassInitialize(TestContext testContext)
 {
     var structureFileData = "FirstPackage/\n" +
                             "FirstPackage/Unix/\n" +
                             "FirstPackage/Unix/tags/\n" +
                             "FirstPackage/Unix/tags/FirstVersion/\n" +
                             "FirstPackage/Unix/tags/FirstVersion/metadata.xml\n" +
                             "FirstPackage/Unix/tags/FirstVersion/testp.zip\n" +
                             "FirstPackage/Unix/tags/SecondVersion/\n" +
                             "FirstPackage/Unix/tags/SecondVersion/metadata.xml\n" +
                             "FirstPackage/Unix/tags/SecondVersion/testp.zip\n" +
                             "FirstPackage/Unix/trunk/\n" +
                             "FirstPackage/Unix/trunk/metadata.xml\n" +
                             "FirstPackage/Unix/trunk/testp.zip\n" +
                             "FirstPackage/Windows/\n" +
                             "FirstPackage/Windows/tags/\n" +
                             "FirstPackage/Windows/tags/ProtoVersion/\n" +
                             "FirstPackage/Windows/tags/ProtoVersion/metadata.xml\n" +
                             "FirstPackage/Windows/tags/ProtoVersion/testp.zip\n" +
                             "FirstPackage/Windows/tags/SecondVersion/\n" +
                             "FirstPackage/Windows/tags/SecondVersion/metadata.xml\n" +
                             "FirstPackage/Windows/tags/SecondVersion/testp.zip\n" +
                             "FirstPackage/Windows/tags/ThirdVersion/\n" +
                             "FirstPackage/Windows/tags/ThirdVersion/metadata.xml\n" +
                             "FirstPackage/Windows/tags/ThirdVersion/testp.zip\n" +
                             "FirstPackage/Windows/trunk/\n" +
                             "FirstPackage/Windows/trunk/metadata.xml\n" +
                             "FirstPackage/Windows/trunk/testp.zip\n";
     File.WriteAllText(path, structureFileData);
 }
Exemple #15
0
        public static void MyClassInitialize(TestContext testContext)
        {
            Greyscale conv = new Greyscale();
            testBitmap = new Bitmap(testPixel, testPixel);
            for (int height = 0; height < testBitmap.Height; height++)
            {
                for (int width = 0; width < testBitmap.Width; width++)
                {
                    testBitmap.SetPixel(width, height, Color.White);
                    width++;
                    testBitmap.SetPixel(width, height, Color.Black);
                    width++;
                    testBitmap.SetPixel(width, height, Color.Red);
                    width++;
                    testBitmap.SetPixel(width, height, Color.Green);
                    width++;
                    testBitmap.SetPixel(width, height, Color.Blue);
                }
            }

            //create greyscale
            double[] newColorValues = new double[3];
            for (int i = 0; i < newColorValues.GetLength(0); i++)
            {
                newColorValues[i] = 1;
            }
            fullGrey = new Memento("Blur", newColorValues);

            //get greyscaled Bitmap
            original = conv.getMemento();
            conv.setMemento(fullGrey);
            processedBitmap = conv.process(testBitmap);
            conv.setMemento(original);
        }
 public static void TestClassSetup(TestContext context)
 {
     _configuration = new Configuration();
     _configuration.Configure();
     _configuration.AddAssembly(typeof(Draft).Assembly);
     _sessionFactory = _configuration.BuildSessionFactory();
 }
        public static void ClassInit(TestContext context)
        {
            _startingHandCombos = new Dictionary<string, WeightedStartingHandCombo>();
            _startingHandPermutations = new Dictionary<string, WeightedStartingHandCombo>();

            //All starting hands match a regular expression after ToString is called
            List<Card> cards = new List<Card>();
            foreach (Rank r in (Rank[])Enum.GetValues(typeof(Rank)))
            {
                foreach (Suit s in (Suit[])Enum.GetValues(typeof(Suit)))
                {
                    cards.Add(new Card(r, s));
                }
            }

            for (int iFirstCard = 0; iFirstCard < 52; iFirstCard++)
            {
                for (int iSecondCard = iFirstCard + 1; iSecondCard < 52; iSecondCard++)
                {
                    WeightedStartingHandCombo hand = new WeightedStartingHandCombo(cards[iFirstCard], cards[iSecondCard], 1);
                    _startingHandCombos.Add(hand.ToString(false), hand);
                    _startingHandPermutations.Add(hand.ToString(), hand);

                    WeightedStartingHandCombo handOppOrder = new WeightedStartingHandCombo(cards[iSecondCard], cards[iFirstCard], 1);
                    _startingHandPermutations.Add(handOppOrder.ToString(), handOppOrder);
                }
            }

            Assert.IsTrue(_startingHandCombos.Count == (52 * 51) / 2, "Incorrect number of combo's.");
            Assert.IsTrue(_startingHandPermutations.Count == 52 * 51, "Incorrect number of permutations.");
        }
        public static void AssemblyInit(TestContext context)
        {
            Configuration.Instance.Init();
            Program.Init();

            File.Delete(Configuration.Instance.PrimaryDatabaseName);
        }
 public static void FeatureSetup(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
 {
     testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(null, 0);
     TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "PlayerMovement", "\tIn Order to play the game of monopoly\r\n\tas a player\r\n\tI want to move around the " +
                                                                                   "board", ProgrammingLanguage.CSharp, ((string[])(null)));
     testRunner.OnFeatureStart(featureInfo);
 }
Exemple #20
0
        public static void MyClassInitialize(TestContext testContext)
        {
            kernel = new StandardKernel(new TestModule(), new DalIoc(), new BusinessIoc());

            var auth = kernel.Get<IAuthenticationService>();
            var uh = kernel.Get<IUtilisateurBusinessHelper<Utilisateur>>();
            uh.DeleteAll().Wait();

            uh.Create("999", "jcambert", "korben90", "Ambert", "Jean-Christophe", "*****@*****.**")

                .ContinueWith(x =>
                {
                    uh.AddRole(x.Result, "Administrateur");
                })
                .ContinueWith(x =>
                {
                    uh.Save();
                }).ContinueWith(x =>
                {
                    var islogin = auth.Login("999", "jcambert", "korben90");
                    Assert.IsTrue(islogin.Result);

                }).Wait()
                ;
            ah = kernel.Get<ArticleBusinessHelper<Article>>();
            ctx = kernel.Get<IDbContext>();
        }
        public static void MyClassInitialize(TestContext testContext)
        {
            ObjectFactory.Inject<IEnvironment>(new Environment());
            ObjectFactory.Inject<IDatabaseConnection>(new DatabaseConnection());

            _environment = ObjectFactory.GetInstance<IEnvironment>();
        }
 public static void PlatformClientInitialize(TestContext testContext)
 {
     clientStabA = new PlatformClientStub(new System.Net.CookieContainer());
     clientStabA.AtValue = "initDt_AtValue";
     clientStabA.EjxValue = "initDt_EjxValue";
     clientStabA.PvtValue = "initDt_PvtValue";
 }
Exemple #23
0
        public static void MyClassInitialize(TestContext testContext)
        {
            container = TestManager.ConfigureUnityContainer("unity");

            UserService = container.Resolve<IUserService>();
            GroupService = container.Resolve<IGroupService>();
        }
        public static void ClassInit(TestContext context)
        {
            SetTestSettings();

            if (defaultAzureSubscription.Equals(null))
            {
                Assert.Inconclusive("No Subscription is selected!");
            }

            vhdBlobLocation = blobUrlRoot + vhdBlob;
            try
            {
                vmPowershellCmdlets.AddAzureVhd(new FileInfo(localFile), vhdBlobLocation);
            }
            catch (Exception e)
            {
                if (e.ToString().Contains("already exists"))
                {
                    // Use the already uploaded vhd.
                    Console.WriteLine("Using already uploaded blob..");
                }
                else
                {
                    throw;
                }
            }
        }
Exemple #25
0
 public static void MyClassInitialize(TestContext testContext)
 {
     testStrings = new List<string>();
     testStrings.AddRange(File.ReadLines("..\\..\\..\\..\\Test\\CoApp\\Toolkit\\Extensions\\TestStrings.txt"));
     Files = new List<string>();
     Files.AddRange(File.ReadLines("..\\..\\..\\..\\Test\\CoApp\\Toolkit\\Extensions\\FileList.txt"));
 }
        public static void MyClassInitialize(TestContext testContext)
        {
            _tasks = new[]
            {
                new TestTask(Priority.High),
                new TestTask(Priority.High),
                new TestTask(Priority.Normal),
                new TestTask(Priority.Low)
            };

            _lowtasks = new[]
            {
                new TestTask(Priority.Low),
                new TestTask(Priority.Low)
            };

            _normallowtasks = new[]
            {
                new TestTask(Priority.Low),
                new TestTask(Priority.Normal)
            };

            _highlowtasks = new[]
            {
                new TestTask(Priority.Low),
                new TestTask(Priority.High)
            };
        }
        public static void MyClassInitialize(TestContext testContext)
        {
            container = TestManager.ConfigureUnityContainer("unity");

            productService = container.Resolve<IProductService>();

        }
        public static void init(TestContext testContext)
        {
            webServer = startServer();



        }
Exemple #29
0
 public static void MyClassInitialize(TestContext testContext) 
 {
     List<TestData> testData = TestDataSet.LoadFromXMLFile("TestData.xml");
     TestData = new Dictionary<string, TestData>();
     for (int i = 0; i < testData.Count; i++)
     {
         TestData.Add(testData[i].Name, testData[i]);
     }
     AggregateLookup = new Dictionary<AggregateType, NodeId>()
     {
         { AggregateType.AnnotationCount, Opc.Ua.ObjectIds.AggregateFunction_AnnotationCount },
         { AggregateType.Average, Opc.Ua.ObjectIds.AggregateFunction_Average },
         { AggregateType.Count, Opc.Ua.ObjectIds.AggregateFunction_Count },
         { AggregateType.Delta, Opc.Ua.ObjectIds.AggregateFunction_Delta },
         { AggregateType.DurationBad, Opc.Ua.ObjectIds.AggregateFunction_DurationBad },
         { AggregateType.DurationGood, Opc.Ua.ObjectIds.AggregateFunction_DurationGood },
         { AggregateType.DurationInState0, Opc.Ua.ObjectIds.AggregateFunction_DurationInStateZero},
         { AggregateType.DurationInState1, Opc.Ua.ObjectIds.AggregateFunction_DurationInStateNonZero},
         { AggregateType.End, Opc.Ua.ObjectIds.AggregateFunction_End },
         { AggregateType.Interpolative, Opc.Ua.ObjectIds.AggregateFunction_Interpolative },
         { AggregateType.Max, Opc.Ua.ObjectIds.AggregateFunction_Maximum },
         { AggregateType.MaxActualTime, Opc.Ua.ObjectIds.AggregateFunction_MaximumActualTime },
         { AggregateType.Min, Opc.Ua.ObjectIds.AggregateFunction_Minimum },
         { AggregateType.MinActualTime, Opc.Ua.ObjectIds.AggregateFunction_MinimumActualTime },
         { AggregateType.NumberOfTransitions, Opc.Ua.ObjectIds.AggregateFunction_NumberOfTransitions },
         { AggregateType.PercentBad, Opc.Ua.ObjectIds.AggregateFunction_PercentBad },
         { AggregateType.PercentGood, Opc.Ua.ObjectIds.AggregateFunction_PercentGood },
         { AggregateType.Range, Opc.Ua.ObjectIds.AggregateFunction_Range },
         { AggregateType.Start, Opc.Ua.ObjectIds.AggregateFunction_Start },
         { AggregateType.TimeAverage, Opc.Ua.ObjectIds.AggregateFunction_TimeAverage },
         { AggregateType.Total, Opc.Ua.ObjectIds.AggregateFunction_Total },
         { AggregateType.TotalizeAverage, Opc.Ua.ObjectIds.AggregateFunction_Total2},
         { AggregateType.WorstQuality, Opc.Ua.ObjectIds.AggregateFunction_WorstQuality }
     };
 }
        public static void MyClassInitialize(TestContext testContext)
        {
            FileManager.CopyTestClasses();

            var report = XDocument.Load(filePath);
            assemblies = new DynamicCodeCoverageParser(report).Assemblies;
        }
        public static void InitClass(TestContext context)
        {
            dataSource = new TestDataSource();
            ScarfConfiguration.DataSourceFactory = new TestDataSourceFactory(dataSource);

            ScarfConfiguration.ConfigurationSection = ConfigurationMocks.CreateNewScarfSectionMock().Object;
        }
 public static void Init(TestContext tctx)
 {
     using (var fs = new FileStream("Config\\AwsS3HandlerParams.json", FileMode.Open))
     {
         _handlerParams = JsonHelper.Load<Config.AwsS3HandlerParams>(fs);
     }
 }
Exemple #33
0
 public UseCase(string name, TestContext testContext)
 {
     this.name = name;
     ctx = testContext;
     fileList = new List<string>();
     actions = new List<Action>();
 }
Exemple #34
0
        public static void Setup(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext _context)
        {
            var applicationDir  = _context.DeploymentDirectory;
            var applicationPath = Path.Combine(applicationDir, "..\\..\\..\\UnitTestProject1\\bin\\Debug\\Good_Night");

            application      = Application.Launch(applicationPath);
            window           = application.GetWindow("MainWindow", InitializeOption.NoCache);
            home_button      = window.Get <Button>("HomeButton");
            data_button      = window.Get <Button>("DataButton");
            lastnight_button = window.Get <Button>("LastNightButton");
            date_picker      = window.Get <WpfDatePicker>("DatePicker");
            morningbutton_1  = window.Get <RadioButton>("MorningButton1");
            morningbutton_2  = window.Get <RadioButton>("MorningButton2");
            morningbutton_3  = window.Get <RadioButton>("MorningButton3");
            morningbutton_4  = window.Get <RadioButton>("MorningButton4");
            morningbutton_5  = window.Get <RadioButton>("MorningButton5");
            morningbutton_6  = window.Get <RadioButton>("MorningButton6");
            morningbutton_7  = window.Get <RadioButton>("MorningButton7");
            morningbutton_8  = window.Get <RadioButton>("MorningButton8");
            morningbutton_9  = window.Get <RadioButton>("MorningButton9");
            morningbutton_10 = window.Get <RadioButton>("MorningButton10");
            daybutton_1      = window.Get <RadioButton>("DayButton1");
            daybutton_2      = window.Get <RadioButton>("DayButton2");
            daybutton_3      = window.Get <RadioButton>("DayButton3");
            daybutton_4      = window.Get <RadioButton>("DayButton4");
            daybutton_5      = window.Get <RadioButton>("DayButton5");
            daybutton_6      = window.Get <RadioButton>("DayButton6");
            daybutton_7      = window.Get <RadioButton>("DayButton7");
            daybutton_8      = window.Get <RadioButton>("DayButton8");
            daybutton_9      = window.Get <RadioButton>("DayButton9");
            daybutton_10     = window.Get <RadioButton>("DayButton10");
            submit_button    = window.Get <Button>("Submit");
        }
		public static void MyClassInitialize(TestContext testContext)
		{
			if (!Directory.Exists(Utility.RootFolder))
			{
				Directory.CreateDirectory(Utility.RootFolder);
			}
			if (!Directory.Exists(Utility.TempFolder))
			{
				Directory.CreateDirectory(Utility.TempFolder);
			}
			_mXmlNs = Utility.NS;
			_mOnGenerator = new OneNoteGenerator(Utility.RootFolder);
			//Get Id of the test notebook so we chould retrieve generated content
			//KindercareFormatConverter will create notebookName as Kindercare
			_mNotebookId = _mOnGenerator.CreateNotebook(NotebookName);

			var word = new Application();
			var doc = word.Application.Documents.Add();

			//add pages to doc
			for (int i = 1; i < DocPageTitles.Count; i++)
			{
				doc.Content.Text += DocPageTitles[i];
				doc.Words.Last.InsertBreak(WdBreakType.wdPageBreak);
			}

			var filePath = TestDocPath as object;
            doc.SaveAs(ref filePath);
            ((_WordDocument)doc).Close();
            ((_WordApplication)word).Quit();
		}
 public static void Init(TestContext x)
 {
     OpenQA.Selenium.Firefox.FirefoxDriver fd = new OpenQA.Selenium.Firefox.FirefoxDriver();
     Browsers.Add(fd);
     OpenQA.Selenium.Chrome.ChromeDriver cd = new OpenQA.Selenium.Chrome.ChromeDriver();
     Browsers.Add(cd);
 }
Exemple #37
0
 public static void ClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
 {
     if (!HasHQL)
     {
         Assert.IsFalse(IsHyper);
         Assert.IsFalse(IsThrift);
     }
 }
Exemple #38
0
        public static void CreateContext(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
        {
            Effort.Provider.EffortProviderConfiguration.RegisterProvider();

            using (var context = new ModelAndContext.EntityContext())
            {
                ModelAndContext.My.CreateBD(context);
            }
        }
Exemple #39
0
 public static void AssemblyInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
 {
     ConnectionString = ConfigurationManager.AppSettings["ConnectionString"].Trim();
     NsName           = ConfigurationManager.AppSettings["Namespace"].Trim();
     Assert.IsFalse(string.IsNullOrEmpty(NsName));
     Assert.AreNotEqual(NsName, "/"); // avoid using root namespace
     Logging.Logfile             = Assembly.GetAssembly(typeof(TestBase)).Location + ".log";
     Logging.LogMessagePublished = message => Trace.WriteLine(message);
 }
        public static void InitialState(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext _context)
        {
            var applicationDir  = _context.DeploymentDirectory;
            var applicationPath = Path.Combine(applicationDir, "..\\..\\..\\ExpenditureTracker\\bin\\Debug\\ExpenditureTracker");

            application    = Application.Launch(applicationPath);
            window         = application.GetWindow("MainWindow", InitializeOption.NoCache);
            receipt_button = window.Get <Button>("ButtonToReceiptForm");
            report_button  = window.Get <Button>("ButtonToReportForm");
        }
        public static void ClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
        {
            table = EnsureTable(typeof(TestAsyncTableScanner), Schema);
            InitializeTableData(table);

            if (!HasPeriodicFlushTableMutator)
            {
                Assert.IsFalse(IsHyper);
                Assert.IsFalse(IsThrift);
            }
        }
Exemple #42
0
 public static void InitSettings(TestContext context)
 {
     if (!Directory.Exists(AppSettings.DataDir))
     {
         Directory.CreateDirectory(AppSettings.DataDir);
     }
     AppSettings.Default = AppSettings.Load();
     Session.Current.AvailableScrapers = Utils.GetAllSubClassInstances <ScraperBase>().ToList();
     Session.Current.AvailableScrapers.Sort((s1, s2) => string.CompareOrdinal(s1.WebsiteName, s2.WebsiteName));
     Logger.Instance.OnLogged += (message, color) => Console.WriteLine(message);
     CookieCollector.Default   = new CookieCollector();
 }
 public static void StartAzureBeforeAllTestsIfNotUp(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
 {
     if (!AzureStorageEmulatorManager.IsProcessStarted())
     {
         AzureStorageEmulatorManager.StartStorageEmulator();
         _wasUp = false;
     }
     else
     {
         _wasUp = true;
     }
 }
Exemple #44
0
        public static void Setup(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext _context)
        {
            var applicationDir  = _context.DeploymentDirectory;
            var applicationPath = Path.Combine(applicationDir, "..\\..\\..\\GoalDigger\\bin\\Debug\\GoalDigger");

            application      = Application.Launch(applicationPath);
            window           = application.GetWindow("MainWindow", InitializeOption.NoCache);
            NavState_TextBox = window.Get <TextBox>("NavStateTextBox");
            BackNav_Button   = window.Get <Button>("BackNavButton");
            Budget_Button    = window.Get <Button>("Budget");
            Profile_Button   = window.Get <Button>("Profile");
            Update_Button    = window.Get <Button>("Update");
            WishList_Button  = window.Get <Button>("WishList");
        }
Exemple #45
0
        public static void Setup(TestContext context)
        {
            testDict = new Dictionary <string, object>();
            testDict.Add("Prop1", "value1");
            testDict.Add("Prop2", 999);
            DateTime timeNow = DateTime.Now;

            testDict.Add("Prop3", timeNow);
            IDictionary <string, object> subDict = new Dictionary <string, object>();

            testDict.Add("Prop4", subDict);
            subDict.Add("subProp1", "sub value 1");
            subDict.Add("subprop2", null);
        }
        public static void ClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
        {
            PtfTestClassBase.Initialize(context);
            string userPassword = LsadManagedAdapter.Instance(BaseTestSite).DomainUserPassword;
            string newUserName  = LsadManagedAdapter.DomainUserName;
            string domainNC     = "DC=" + LsadManagedAdapter.Instance(BaseTestSite).PrimaryDomainDnsName.Replace(".", ",DC=");
            string parentDN     = string.Format("CN=Users,{0}", domainNC);
            string userDN       = string.Format("CN={0},CN=Users,{1}", newUserName, domainNC);

            if (Utilities.IsObjectExist(userDN, LsadManagedAdapter.Instance(BaseTestSite).PDCNetbiosName, LsadManagedAdapter.Instance(BaseTestSite).ADDSPortNum))
            {
                Utilities.RemoveUser(LsadManagedAdapter.Instance(BaseTestSite).PDCNetbiosName, LsadManagedAdapter.Instance(BaseTestSite).ADDSPortNum, parentDN, newUserName);
            }
            Utilities.NewUser(LsadManagedAdapter.Instance(BaseTestSite).PDCNetbiosName, LsadManagedAdapter.Instance(BaseTestSite).ADDSPortNum, parentDN, newUserName, userPassword);
        }
Exemple #47
0
        internal static TestCustomAttribute GetCustomAttribute(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
        {
            TestCustomAttribute attr = new TestCustomAttribute
            {
                Login = Convert.ToString(context.DataRow["Login"]),
                Name  = Convert.ToString(context.DataRow["AttributeName"]),
                Value = Convert.ToString(context.DataRow["AttributeValue"]),
            };

            if (context.DataRow["MultiValued"] != System.DBNull.Value)
            {
                attr.MultiValued = Convert.ToBoolean(context.DataRow["MultiValued"]);
            }
            return(attr);
        }
Exemple #48
0
        internal static TestGroup GetGroup(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
        {
            TestGroup group = new TestGroup
            {
                Id          = Convert.ToInt32(context.DataRow["Id"]),
                Name        = Convert.ToString(context.DataRow["Name"]),
                Description = Convert.ToString(context.DataRow["Description"]),
            };

            if (context.DataRow["Users"] != null && !(context.DataRow["Users"] is System.DBNull) && !string.IsNullOrEmpty((string)context.DataRow["Users"]))
            {
                string strUsers = (string)context.DataRow["Users"];
                group.Users = strUsers.Split(',').ToList <string>();
            }
            return(group);
        }
Exemple #49
0
        public static void Setup(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext _context)
        {
            var applicationDir  = _context.DeploymentDirectory;
            var applicationPath = Path.Combine(applicationDir, "..\\..\\..\\StoryTests\\bin\\Debug\\Gass-E");

            application = Application.Launch(applicationPath);


            window    = application.GetWindow("MainWindow", InitializeOption.NoCache);
            NewFillUp = window.Get <Button>("NewFillUp");
            Reset     = window.Get <Button>("Reset");
            Submit    = window.Get <Button>("Submit");
            Odo       = window.Get <TextBox>("Odometer");
            Cost      = window.Get <TextBox>("CostofFillUp");
            Date      = window.Get <TextBox>("Date");
        }
        public static void StartAzureBeforeAllTestsIfNotUp(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
        {
            if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("StorageConnectionString")))
            {
                return;
            }

            if (!AzureStorageEmulatorManager.IsProcessStarted())
            {
                AzureStorageEmulatorManager.StartStorageEmulator();
                _wasUp = false;
            }
            else
            {
                _wasUp = true;
            }
        }
Exemple #51
0
        public static void ClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
        {
            if (!HasCounterColumn)
            {
                Assert.IsFalse(IsHyper);
                Assert.IsFalse(IsThrift);

                return;
            }

            const string Schema =
                "<Schema><AccessGroup name=\"default\" blksz=\"1024\">" + "<ColumnFamily><Name>a</Name><Counter>true</Counter></ColumnFamily>"
                + "<ColumnFamily><Name>b</Name><Counter>true</Counter></ColumnFamily>" + "<ColumnFamily><Name>c</Name><Counter>true</Counter></ColumnFamily>"
                + "</AccessGroup></Schema>";

            table = EnsureTable(typeof(TestCounter), Schema);
        }
Exemple #52
0
        public static void InitTestSuite(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
        {
            context = testContext;

            var myDatabaseName = "mydatabase_" + DateTime.Now.ToFileTimeUtc();

            var options = new DbContextOptionsBuilder <AppDbContext>()
                          .UseInMemoryDatabase(databaseName: myDatabaseName)
                          .Options;

            _appDbContext = new AppDbContext(options);
            _appDbContext.Movies.Add(new Movies.API.Movies {
                Id = 1, Name = "Test 1", PortraitUrl = "none", Year = 2000
            });
            _appDbContext.Movies.Add(new Movies.API.Movies {
                Id = 2, Name = "Test 2", PortraitUrl = "none", Year = 2000
            });
            _appDbContext.Movies.Add(new Movies.API.Movies {
                Id = 3, Name = "Test 3", PortraitUrl = "none", Year = 2000
            });
            _appDbContext.Movies.Add(new Movies.API.Movies {
                Id = 4, Name = "Test 4", PortraitUrl = "none", Year = 2000
            });
            _appDbContext.Movies.Add(new Movies.API.Movies {
                Id = 5, Name = "Test 5", PortraitUrl = "none", Year = 2000
            });
            _appDbContext.Movies.Add(new Movies.API.Movies {
                Id = 6, Name = "Test 6", PortraitUrl = "none", Year = 2000
            });
            _appDbContext.Movies.Add(new Movies.API.Movies {
                Id = 7, Name = "Test 7", PortraitUrl = "none", Year = 2000
            });
            _appDbContext.Movies.Add(new Movies.API.Movies {
                Id = 8, Name = "Test 8", PortraitUrl = "none", Year = 2000
            });
            _appDbContext.Movies.Add(new Movies.API.Movies {
                Id = 9, Name = "Test 9", PortraitUrl = "none", Year = 2000
            });
            _appDbContext.Movies.Add(new Movies.API.Movies {
                Id = 10, Name = "Test 10", PortraitUrl = "none", Year = 2000
            });
            _appDbContext.SaveChanges();
        }
Exemple #53
0
        //  [AssemblyInitialize]
        public static void Initialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext tc)
        {
            switch (ConfigurationManager.AppSettings.Get(AppConfigKeys.Browser))
            {
            case "Firefox":
                ObjectRepository.Driver = GetFirefoxDriver();
                NavigateHelper.WebSite(ConfigurationManager.AppSettings.Get(AppConfigKeys.WebSite));
                break;

            case "Chrome":
                ObjectRepository.Driver = GetChromeBrowseer();
                NavigateHelper.WebSite(ConfigurationManager.AppSettings.Get(AppConfigKeys.WebSite));
                break;

            case "IE":
                //   ObjectRepository.IEOptions = GetIEDriver();
                ObjectRepository.Driver = new InternetExplorerDriver(GetIEDriver());
                NavigateHelper.WebSite(ConfigurationManager.AppSettings.Get(AppConfigKeys.WebSite));
                break;
            }
        }
        public static void ClassInitialize(TestContext context)
        {
            CommandSchedulerDbContext.NameOrConnectionString = @"Data Source=(localdb)\v11.0; Integrated Security=True; MultipleActiveResultSets=False; Initial Catalog=ItsCqrsTestsCommandScheduler";

            Settings.Sources        = new ISettingsSource[] { new ConfigDirectorySettings(@"c:\dev\.config") }.Concat(Settings.Sources);
            settings                = Settings.Get <ServiceBusSettings>();
            settings.ConfigureQueue = queue => queue.AutoDeleteOnIdle = TimeSpan.FromHours(24);

#if !DEBUG
            new CommandSchedulerDbContext().Database.Delete();
#endif

            using (var readModels = new CommandSchedulerDbContext())
            {
                new CommandSchedulerDatabaseInitializer().InitializeDatabase(readModels);
            }

            Console.WriteLine(Environment.MachineName);
            Console.WriteLine(new DirectoryInfo(@"c:\dev\.config").GetFiles().Select(f => f.FullName).ToLogString());
            Settings.Sources = new ISettingsSource[] { new ConfigDirectorySettings(@"c:\dev\.config") }.Concat(Settings.Sources);
        }
Exemple #55
0
        public static void ClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext testContext)
        {
            const string Schema =
                "<Schema><AccessGroup name=\"default\" blksz=\"1024\">" +
                "<ColumnFamily><Name>a</Name></ColumnFamily>" +
                "<ColumnFamily><Name>b</Name></ColumnFamily>" +
                "<ColumnFamily><Name>c</Name></ColumnFamily>" +
                "</AccessGroup></Schema>";

            tableA = EnsureTable(typeof(TestMultipleInstances), Schema);

            var properties = new Dictionary <string, object> {
                { "Uri", UriB }
            };

            contextB = Hypertable.Context.Create(ConnectionString, properties);
            clientB  = contextB.CreateClient();
            nsB      = clientB.OpenNamespace(NsName, OpenDispositions.OpenAlways);
            nsB.DropTable(typeof(TestMultipleInstances).Name, DropDispositions.IfExists);
            nsB.CreateTable(typeof(TestMultipleInstances).Name, Schema);
            tableB = nsB.OpenTable(typeof(TestMultipleInstances).Name);
        }
Exemple #56
0
        public static void Init(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
        {
            var browser = context.Properties["browser"]?.ToString();
            var baseurl = context.Properties["baseurl"]?.ToString();
            var custom  = context.Properties["custom"]?.ToString();

            //throw new Exception($"params: {browser} : {baseurl} : {custom}");

            //DriverSetup.AutoSetUp(BrowserNames.Chrome);



            AtataContext.GlobalConfiguration
            .UseBaseUrl("https://google.co.uk")
            .UseDriver(browser)
            .AutoSetUpConfiguredDrivers();
            //.UseChrome()
            //.AutoSetUpDriverToUse();
            //.UseChrome().WithDriverPath(Environment.GetEnvironmentVariable("ChromeWebDriver"))
            //.UseFirefox().WithDriverPath(Environment.GetEnvironmentVariable("GeckoWebDriver"))
            //.UseInternetExplorer().WithDriverPath(Environment.GetEnvironmentVariable("IEWebDriver"))
        }
 public static void ClassInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
 {
     PtfTestClassBase.Initialize(context);
 }
Exemple #58
0
 public static void Setup(TestContext context)
 {
 }
Exemple #59
0
        public static new void RegisterAssemblies(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
        {
            AbstractIocTest.RegisterAssemblies(context);

            AssemblyHelper.RegisterAssemblyFromType(typeof(Material));
        }
 public static void AssemblyInitialize(Microsoft.VisualStudio.TestTools.UnitTesting.TestContext context)
 {
     Main();
 }