public void Setup()
        {
            if (useMockDirectory)
            {
                _userDirectoryService = null;
                //TODO Initialize mock directory
                throw new NotImplementedException("MockDirectory have not implemented yet");
            }
            else if (useSQLServer)
            {
                var context = DataBaseBuilder.BuildDataBaseContext();
                var service = new EntityUserOrderDirectory(context);
                _userDirectoryService  = service;
                _orderDirectoryService = service;
            }
            else
            {
                var service = new MemoryUserOrderDirectory();
                _userDirectoryService  = service;
                _orderDirectoryService = service;
            }

            AddTwoUsers();
            _defaultUser = UserDirectoryService.GetUsers().First();

            _orderController = new OrderController(_orderDirectoryService);
        }
Esempio n. 2
0
        public void Setup()
        {
            var memoryDirectory = new MemoryUserOrderDirectory();

            _userDirectoryInMemory  = memoryDirectory;
            _orderDirectoryInMemory = memoryDirectory;

            _userProfile1 = CreateDefaultUserProfile();
            _userProfile2 = CreateDefaultUserProfile(
                login: "******", profileName: "Ivan",
                address: "Prityckova str.29", phoneNumber: "123-45-678");
        }
        private static void ConfigureInMemoryDataBase(this IServiceCollection services, IConfiguration DirectoryConfiguration)
        {
            var directoryService = new MemoryUserOrderDirectory();

            services.AddSingleton(typeof(IOrderDirectoryServise), directoryService);
            services.AddSingleton(typeof(IUserDirectoryServise), directoryService);

            bool addTestData = DirectoryConfiguration.ReadBoolProperty(AddTestDataPropertyName);

            if (addTestData)
            {
                var testData = new TestDataFiller(directoryService, directoryService);
                testData.FillIfEmpty();
            }
        }
 public void Setup()
 {
     _directoryInMemory = new MemoryUserOrderDirectory();
 }