Exemplo n.º 1
0
        public void StorageLocationService_Should_return_LocalStorageService_for_localpath()
        {
            Helper.CreateDummyCustomers();
            var storageService = StorageLocationService.GetStorageService(ConfigurationManager.Settings.OutputFile);

            Assert.IsInstanceOfType(storageService, typeof(LocalStorageService));
        }
        public void CustomerRepositery_should_throw_exception_for_invalid_location()
        {
            var path           = @"C:\customers.txt";
            var storageService = StorageLocationService.GetStorageService(path);

            Assert.ThrowsException <Exception>(() => new CustomerRepository(storageService));
        }
        public async Task CustomerRepository_should_return_data_with_specific_distance()
        {
            var storageService = StorageLocationService.GetStorageService(Helper.OutputPath);
            var repository     = new CustomerRepository(storageService);
            var result         = await repository.GetCustomersWithinSpecificDistanceAsync(ConfigurationManager.Settings.OfficeLocation, 100);

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Count());
        }
        public async Task CustomerRepository_should_return_data_for_valid_source()
        {
            var storageService = StorageLocationService.GetStorageService(Helper.OutputPath);
            var repository     = new CustomerRepository(storageService);
            var result         = await repository.GetCustomersAsync();

            Assert.IsNotNull(result);
            Assert.AreEqual(4, result.Count());
        }
        public CustomerInvitationManager(string customerFileLocation)
        {
            var storageService = StorageLocationService.GetStorageService(customerFileLocation);

            customerService = new CustomerRepository(storageService);
            outputWriters   = new IOutputWriter[] {
                new ConsoleWriter(),
                new CustomerOutputFileWriter(customerService)
            };
        }
Exemplo n.º 6
0
        public void StorageLocationService_Should_return_null_when_empty_path()
        {
            var storageService = StorageLocationService.GetStorageService(null);

            Assert.IsNull(storageService);
        }
Exemplo n.º 7
0
        public void StorageLocationService_Should_return_OnlineStorageService_for_validUri()
        {
            var storageService = StorageLocationService.GetStorageService("https://google.com");

            Assert.IsInstanceOfType(storageService, typeof(OnlineStorageService));
        }