示例#1
0
        public PeopleRepoTests()
        {
            _peopleStore = Substitute.For <IPeopleStore>();
            _fileService = Substitute.For <IFileService>();
            _jsonService = Substitute.For <IJsonService>();

            _peopleRepo = new PeopleRepo(_peopleStore, _fileService, _jsonService, Options.Create(new DataFileSettings()));
        }
示例#2
0
        public PeopleRepo(IPeopleStore peopleStore, IFileService fileService, IJsonService jsonService, IOptions <DataFileSettings> options)
        {
            _peopleStore = peopleStore;

            if (_peopleStore.Data == null)
            {
                var jsonText = fileService.GetFileContents(options.Value.PeopleJsonFilename);
                _peopleStore.Data = jsonService.Parse <List <Person> >(jsonText);
            }
        }
示例#3
0
        private void cbbUse_SelectedValueChanged(object sender, EventArgs e)
        {
            var x = cbbUse.SelectedItem;

            if (x is Memory)
            {
                store = new Memory();
            }
            else
            {
                store = new PeopleStore();
            }
        }