/// <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(); }
/// <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(); }
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); }
public PetService(IPets repo) { if (repo == null) { throw new ArgumentNullException(); } this.petRepository = repo; this.awlService = new AwlService(repo); this.rspcaService = new RspcaService(repo); }
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(); }
//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 } }
public RspcaService(IPets allPets) { this.allPets = allPets ?? throw new ArgumentNullException(); client.Timeout = TimeSpan.FromSeconds(60); client.BaseAddress = new Uri("https://www.adoptapet.com.au/"); }
/// <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(); }
/// <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(); }
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; }
public AwlService(IPets allPets) { this.allPets = allPets ?? throw new ArgumentNullException(); client.Timeout = TimeSpan.FromSeconds(60); client.BaseAddress = new Uri("https://awl.org.au/"); }
public void Adopt(IPets pet) { this.Pets.Add(pet); pet.OwnerName = this.Name; }
/// <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(); }
public HomeController(IPets pets, IFoodAndDrinks foodAndDrinks) { this.pets = pets; this.foodAndDrinks = foodAndDrinks; }
/// <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); }
//constructor injection public PetsApiSvc(IPets pets) { _pets = pets; }