Пример #1
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     Pets    = new Pets(this);
     BaseUri = new System.Uri("http://petstore.swagger.wordnik.com/api");
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Formatting.Indented,
         DateFormatHandling    = DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = DateTimeZoneHandling.Utc,
         NullValueHandling     = NullValueHandling.Ignore,
         ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = DateTimeZoneHandling.Utc,
         NullValueHandling     = NullValueHandling.Ignore,
         ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
Пример #2
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     this.Pets             = new Pets(this);
     this.BaseUri          = new System.Uri("http://petstore.swagger.wordnik.com/api");
     SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
         Converters            = new  System.Collections.Generic.List <Newtonsoft.Json.JsonConverter>
         {
             new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
         }
     };
     DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
         Converters            = new System.Collections.Generic.List <Newtonsoft.Json.JsonConverter>
         {
             new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
         }
     };
     CustomInitialize();
 }
Пример #3
0
 public void Initialize()
 {
     peopleRepository = new Mock <IPeopleRepository>();
     peopleRepository.Setup(p => p.HttpStatusCode).Returns(HttpStatusCode.OK);
     peopleRepository.Setup(p => p.IsInitialized).Returns(true);
     peopleService = new PeopleService(peopleRepository.Object);
     petsDomain    = new Pets(peopleService);
 }
Пример #4
0
 public PetService(IPets repo)
 {
     if (repo == null)
     {
         throw new ArgumentNullException();
     }
     this.petRepository = repo;
     this.awlService    = new AwlService(repo);
     this.rspcaService  = new RspcaService(repo);
 }
Пример #5
0
        public MainWindow()
        {
            allPets    = new PersistentPets();
            petService = new PetService(allPets);
            InitializeComponent();

            ((Model)DataContext).Pets = GetFilteredPets();

            updateTimer           = new Timer(INITIAL_DURATION);
            updateTimer.Elapsed  += fireTimer;
            updateTimer.AutoReset = false;
            updateTimer.Start();
        }
Пример #6
0
 //comfort pet do increase the relationship to master
 public static void ComfortPets(IPets pet, string comfortOption)
 {
     if (comfortOption.ToLower() == "toy")
     {
         //do toys
     }
     else if (comfortOption.ToLower() == "dressup")
     {
         //do dressup
     }
     else if (comfortOption.ToLower() == "food")
     {
         //do food
     }
     else
     {
         //retrun
     }
 }
Пример #7
0
 public RspcaService(IPets allPets)
 {
     this.allPets       = allPets ?? throw new ArgumentNullException();
     client.Timeout     = TimeSpan.FromSeconds(60);
     client.BaseAddress = new Uri("https://www.adoptapet.com.au/");
 }
Пример #8
0
 /// <summary>
 /// Gets a pet from the store
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task GetAsync(this IPets operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Пример #9
0
 /// <summary>
 /// Gets a pet from the store
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static void Get(this IPets operations)
 {
     operations.GetAsync().GetAwaiter().GetResult();
 }
Пример #10
0
 public PetEnvironmentViewModel(IPets pets, IFoodAndDrinks foodAndDrinks)
 {
     this.Pets          = pets;
     this.FoodAndDrinks = foodAndDrinks;
 }
 public PetsController(ILogger <PetsController> logger, IPets petsRepo, IOwners ownersRepo)
 {
     _petsRepo   = petsRepo;
     _logger     = logger;
     _ownersRepo = ownersRepo;
 }
Пример #12
0
 public AwlService(IPets allPets)
 {
     this.allPets       = allPets ?? throw new ArgumentNullException();
     client.Timeout     = TimeSpan.FromSeconds(60);
     client.BaseAddress = new Uri("https://awl.org.au/");
 }
Пример #13
0
 public void Adopt(IPets pet)
 {
     this.Pets.Add(pet);
     pet.OwnerName = this.Name;
 }
Пример #14
0
 /// <summary>
 /// Gets a pet from the store
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static void Get(this IPets operations)
 {
     Task.Factory.StartNew(s => ((IPets)s).GetAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
Пример #15
0
 public HomeController(IPets pets, IFoodAndDrinks foodAndDrinks)
 {
     this.pets          = pets;
     this.foodAndDrinks = foodAndDrinks;
 }
Пример #16
0
 /// <summary>
 /// Gets a pet from the store
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async System.Threading.Tasks.Task GetAsync(this IPets operations, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     await operations.GetWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false);
 }
Пример #17
0
 //constructor injection
 public PetsApiSvc(IPets pets)
 {
     _pets = pets;
 }