Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            IDataStorage        testStorage = new SqliteDataStore();
            PotentialRepository testRepo    = new PotentialRepository(testStorage);

            BuildAvaloniaApp().Start <MainWindow>(() => new MainViewModel(testRepo));
        }
Ejemplo n.º 2
0
        public MainViewModel(PotentialRepository potentialRepo)
        {
            Console.WriteLine("This code executed2");

            this.potentialRepo = potentialRepo;

            //var p = dataStore.GetById(2);
            //Console.WriteLine(ListOfAllPotentials[0].FirstName);
            try
            {
                ListOfAllPotentials = new ObservableCollection <Potential>(this.potentialRepo.GetAllPotentials());
            } catch (Exception e)
            {
            }


            var temp = potentialRepo.GetUserStats();

            userFirstNameFunction              = temp.FirstName;
            userLastNameFunction               = temp.LastName;
            userAgeFunction                    = temp.Age;
            userEnjoysSportsRatingFunction     = temp.EnjoysSportsRating;
            userFrugalityRatingFunction        = temp.FrugalityRating;
            userPhysicallyActiveRatingFunction = temp.PhysicallyActiveRating;
            userDesireForKidsRatingFunction    = temp.DesireForKidsRating;
            userSenseOfHumorRatingFunction     = temp.SenseOfHumorRating;
            userDrivenRatingFunction           = temp.DrivenRating;
            userAdditionalDetailsFunction      = temp.AdditionalDetails;
        }
        public ViewModelLocator()
        {
            // Set up a new variables to instantiate our main view model.
            IDataStorage        testStorage = new SqliteDataStore();
            PotentialRepository testRepo    = new PotentialRepository(testStorage);

            Main = new MainViewModel(testRepo);
        }
Ejemplo n.º 4
0
        //PotentialRepository testRepo;
        //public MainViewModel Main { get; } = new MainViewModel(testRepo);

        public ViewModelLocator()
        {
            IDataStorage        testStorage = new SqliteDataStore();
            PotentialRepository testRepo    = new PotentialRepository(testStorage);

            //BuildAvaloniaApp().Start<MainWindow>(() => new MainViewModel(testRepo));
            //Main = new MainViewModel(testRepo);
            Main = new MainViewModel(testRepo);
        }
Ejemplo n.º 5
0
        public void AddPotential()
        {
            var p = new Potential("Sarah", "Bob", 1, 23, 9, 1, 1, 1, 1, "Some details");
            var mockDataStorage = new Mock <IDataStorage>();
            var potentialRepo   = new PotentialRepository(mockDataStorage.Object);

            var result = potentialRepo.AddPotential(p);

            result.Should().BeTrue();
        }
Ejemplo n.º 6
0
        // Constructor to set up our list of Potentials saved in
        // the Database.
        public MainViewModel(PotentialRepository potentialRepo)
        {
            // Set the class potentialRepo, to the one we want passed in.
            this.potentialRepo = potentialRepo;

            // Get list of potentials from the Database. Otherwise, throw an exception.
            try
            {
                ListOfAllPotentials = new ObservableCollection <Potential>(this.potentialRepo.GetAllPotentials());
            }
            catch (Exception e)
            {
                Console.WriteLine("Was unsuccessful in attempted to get Potentials from Database.");
                Console.WriteLine("Exception Message: " + e.Message);
            }
        }
Ejemplo n.º 7
0
        public void RemovePotential()
        {
            var tempSQLiteDatabase = new SqliteDataStore();
            var p = new Potential("Sarah", "Bob", 1, 23, 9, 1, 1, 1, 1, "Some details");
            var mockDataStorage = new Mock <IDataStorage>();
            var potentialRepo   = new PotentialRepository(mockDataStorage.Object);

            potentialRepo.AddPotential(p);

            //We are making a change here to see if continous integration works on azure.

            var rp = potentialRepo.GetASpecificId(1);

            //var firstName = rp.FirstName;
            //var thisResult = potentialRepo.RemovePotentialById((int)rp);
            //Assert.AreEqual("Potential Removed", thisResult);
            Assert.AreEqual("Sarah", p.FirstName);
        }