Esempio n. 1
0
        private void InitTestDatabase(string competitionName, DateTime date)
        {
            try
            {
                Directory.Delete(@"C:\FeltAdmin\TEST\Database", true);
            }
            catch (Exception ex)
            {
                Log.Error(ex, "Test");
            }

            DatabaseApi.CreateNewCompetition("FeltAdmin", competitionName, date);
        }
Esempio n. 2
0
        public void CreateDatabaseExecute()
        {
            if (string.IsNullOrWhiteSpace(NewDatabaseName))
            {
                MessageBox.Show("Du må angi navn på stevnet");
                return;
            }

            if (NewDatabaseStartTime == DateTime.MinValue)
            {
                NewDatabaseStartTime = DateTime.Now;
            }

            DatabaseApi.CreateNewCompetition(SelectedAvailableTemplate, NewDatabaseName, NewDatabaseStartTime);
            this.InitExistingDatabase();
        }
Esempio n. 3
0
        public void CreateNewCompetition_NewDbCreated()
        {
            Directory.Delete(@"C:\FeltAdmin\TEST\Database");
            var expectedPath  = Path.Combine(@"C:\FeltAdmin\TEST\Database", "TestStevne_2016.02.26");
            var expectedPath1 = Path.Combine(@"C:\FeltAdmin\TEST\Database", "TestStevne_2016.02.26-1");
            var expectedPath2 = Path.Combine(@"C:\FeltAdmin\TEST\Database", "TestStevne_2016.02.26-2");

            DatabaseApi.CreateNewCompetition("FeltAdmin", "TestStevne", new DateTime(2016, 2, 26));
            Thread.Sleep(100);
            DatabaseApi.CreateNewCompetition("FeltAdmin", "TestStevne", new DateTime(2016, 2, 26));
            Thread.Sleep(100);
            DatabaseApi.CreateNewCompetition("FeltAdmin", "TestStevne", new DateTime(2016, 2, 26));

            var directories = DatabaseApi.GetAllCompetitions();

            Assert.IsTrue(Directory.Exists(expectedPath));
            Assert.IsTrue(Directory.Exists(expectedPath1));
            Assert.IsTrue(Directory.Exists(expectedPath2));
            Assert.AreEqual(expectedPath2, directories[0]);
            Assert.AreEqual(expectedPath1, directories[1]);
            Assert.AreEqual(expectedPath, directories[2]);
        }