This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var requestMessage = new HttpRequestMessage(HttpMethod.Get, "https://your.site.com"); | |
| requestMessage.Headers.Authorization = new AuthenticationHeaderValue("Bearer", your_token); | |
| httpClient.SendAsync(requestMessage); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Newtonsoft.Json; | |
| using Newtonsoft.Json.Serialization; | |
| var formatters = GlobalConfiguration.Configuration.Formatters; | |
| var jsonFormatter = formatters.JsonFormatter; | |
| var settings = jsonFormatter.SerializerSettings; | |
| settings.Formatting = Formatting.Indented; | |
| settings.ContractResolver = new CamelCasePropertyNamesContractResolver(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using Newtonsoft.Json; | |
| using System.Collections.Generic; | |
| namespace OneHundredCalories.Models | |
| { | |
| [JsonObject] | |
| public class AlexaRequest | |
| { | |
| [JsonProperty("version")] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void HelpSetupActivitiesFakes( | |
| List<Activity> fakeActivity, | |
| ActivityOutcome fakeOutcome, | |
| List<ArgumentHierarchy> fakeHierarchy) | |
| { | |
| var mockedActivity = RepositoryTestingHelper | |
| .GetMockDbSet<Activity>(fakeActivity.AsQueryable()); | |
| mockedActivity.Setup(x => x.Include("InputArgument")) | |
| .Returns(mockedActivity.Object); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| WITH cte AS | |
| (SELECT *, ROW_NUMBER() OVER (PARTITION BY col1, col2, col3, col4 ORDER BY (SELECT 0)) AS DuplicateRowNumber | |
| FROM table | |
| ) | |
| --SELECT * FROM cte WHERE DuplicateRowNumber > 1 | |
| DELETE FROM cte WHERE DuplicateRowNumber > 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class LocationServiceBuilder | |
| { | |
| //create default behaviors | |
| IHttpService _httpService = Mock.Create<IHttpService>(); | |
| IFileService _fileService = Mock.CreateLike<IFileService>(fs => fs.ReadAllLines(Arg.AnyString) == new string[] { "key" }); | |
| //pass in your own dependency if needed | |
| public LocationServiceBuilder WithHttpService(IHttpService httpService) | |
| { | |
| _httpService = httpService; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet"> | |
| <CodeSnippet Format="1.0.0"> | |
| <Header> | |
| <Title>Async Unit Test</Title> | |
| <Author>Rusty Divine</Author> | |
| <Description>Async Unit Test Template with 3 Parts</Description> | |
| <HelpUrl>https://msdn.microsoft.com/en-us/library/ms165394.aspx</HelpUrl> | |
| <SnippetTypes /> | |
| <Keywords /> |
NewerOlder