Exemplo n.º 1
0
 public void CreateConfig()
 {
     FileStream stream = File.Create(ExistingFile);
     stream.Close();
     _validDataStore = new DataStore { Path = ExistingFile };
     Directory.CreateDirectory(("Content"));
 }
Exemplo n.º 2
0
 public void RemoveFile()
 {
     var dataStore = new DataStore();
     dataStore.CreateDataStore(DataStoreFileName);
     Assert.IsTrue(File.Exists(DataStoreFileName));
     dataStore.RemoveDataStore();
     Assert.IsFalse(File.Exists(DataStoreFileName));
 }
Exemplo n.º 3
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);

            var dataStore = new DataStore();
            dataStore.CreateDataStore(HostingEnvironment.ApplicationPhysicalPath + Properties.Settings.Default["store"].ToString());
        }
Exemplo n.º 4
0
 public static List<EmployeeModel> FindByEmploymentStatusFilter(EmploymentStatusFilter? filterList, string path)
 {
     var dataStore = new DataStore { Path = path };
     var employeeModels = dataStore.GetAllRecords();
     if (filterList.HasValue && filterList != EmploymentStatusFilter.All)
     {
         var removeStatus = (filterList.Value == EmploymentStatusFilter.No);
         employeeModels.RemoveAll(employee => employee.IsCurrentEmployee == removeStatus);
     }
     return employeeModels;
 }
Exemplo n.º 5
0
 public void CreateEmployee()
 {
     _identifier = Guid.Parse("21d9fb81-bdf8-4c4e-b397-01018f30e90b");
     _currentEmployeeModel = new EmployeeModel { Id = _identifier, Age = 5, FirstName = "john", LastName = "smith", IsCurrentEmployee = true };
     var secondEmployeeId = Guid.Parse("31d9fb81-bdf8-4c4e-b397-01018f30e90b");
     _secondEmployeeModel = new EmployeeModel { Id = secondEmployeeId, Age = 1, FirstName = "pete", LastName = "John", Gender = EmployeeGender.Male, IsCurrentEmployee = false };
     _dataStore = new DataStore();
     _dataStore.CreateDataStore("test.data");
     _employeeController = new EmployeeController(_path);
 }
Exemplo n.º 6
0
 public void InvalidRecordCalled()
 {
     var dataStore = new DataStore();
     dataStore.CreateDataStore(DataStoreFileName);
     dataStore.GetRecordById(Guid.NewGuid());
 }
Exemplo n.º 7
0
 public void InvalidPath()
 {
     var invalidDataStore = new DataStore { Path = "failure to communicate" };
 }
Exemplo n.º 8
0
 public void CreateFile()
 {
     var config = new DataStore();
     config.CreateDataStore(DataStorePath + DataStoreFileName);
     Assert.IsTrue(File.Exists(DataStorePath + DataStoreFileName));
 }
Exemplo n.º 9
0
 public static EmployeeModel LoadById(Guid id, string path)
 {
     var dataStore = new DataStore { Path = path };
     return dataStore.GetRecordById(id);
 }
Exemplo n.º 10
0
 public static void DeleteById(Guid id, string path)
 {
     var dataStore = new DataStore { Path = path };
     dataStore.RemoveRecordById(id);
 }
Exemplo n.º 11
0
 public void Save(string path)
 {
     var dataStore = new DataStore { Path = path };
     dataStore.SaveRecord(this);
 }