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 System.Diagnostics; | |
using System.IO; | |
using System.Web.Services.Protocols; | |
namespace SoapService.Client | |
{ | |
public class LogXmlSoap : SoapExtension | |
{ | |
private Stream oldStream; |
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 System.Diagnostics; | |
using System.IO; | |
using System.Web.Services.Protocols; | |
namespace SoapService.Client | |
{ | |
public class LogXmlSoap : SoapExtension | |
{ | |
private Stream oldStream; |
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
/* | |
Proxy all methods from object to log all calls in console for debugging. | |
Exemplo: | |
var myObj = { | |
property: 1, | |
sendTo: function (endpoint) { | |
console.log('sending ' + this.property + ' to ' + endpoint); | |
} | |
}; |
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.Collections.Generic; | |
using System.Linq; | |
using System.Web.Http.Description; | |
using System.Xml.XPath; | |
using Swashbuckle.Swagger; | |
using Swashbuckle.Swagger.XmlComments; | |
namespace Web.Common.Swagger | |
{ | |
public class ApplyTagDescriptionFromControllerSummary : IDocumentFilter |
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 static void Log(string message, params object[] args) | |
{ | |
if (!args.IsEmpty()) | |
{ | |
message = message.With(args); | |
} | |
var msg = "{0:dd/MM/yyyy hh:mm:ss.fff} {1}{2}".With(DateTime.Now, message, Environment.NewLine); | |
File.AppendAllText(@"C:\log.txt", msg); | |
} |
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 System.Data.Entity.Infrastructure; | |
using System.Linq; | |
using System.Threading; | |
using System.Threading.Tasks; | |
namespace Extensions | |
{ | |
/// <summary> | |
/// http://stackoverflow.com/questions/29787098/doesnt-await-when-using-foreachasync-with-await-inside-action#29787099 |
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 System.Web; | |
using System.Web.Mvc; | |
using System.Web.Routing; | |
using LiterateElephant.Web.Common; | |
using LiterateElephant.Web.Common.Utilities; | |
using Moq; | |
using Xunit; | |
namespace LiterateElephant.Tests.Web |
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 MyDbContext : DbContext | |
{ | |
public void ModifiedProperties<TEntity>(TEntity instance, params string[] propertyNames) where TEntity : class, IEquatable<TEntity> | |
{ | |
DbEntityEntry<TEntity> entity = Attached<TEntity>(instance).FirstOrDefault(); | |
if (entity != null) | |
{ | |
entity.State = EntityState.Detached; | |
} |
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 System.Linq; | |
using System.Collections.Generic; | |
using System.Linq.Expressions; | |
using System.Reflection; | |
namespace Util | |
{ | |
public class PropertyExtractor<T> where T : class | |
{ |
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
[Fact] | |
public async Task GivenCorrectlyFile_WhenSaveAsync_ShouldBeStorageFile() | |
{ | |
var filePath = "C:\\CWI\\Elefante Letrado\\src\\LiterateElephant.Tests\\bin\\Debug\\Content\\cdn\\audio\\20160427123212_AudioLouco.mp3"; | |
var fileDataMock = new MockFileData(new byte[0]); | |
var fileSystemMock = new MockFileSystem(); | |
fileSystemMock.AddFile(filePath, fileDataMock); | |
NewerOlder