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 GetByIdTests : BaseTest | |
{ | |
protected Mock<IProductRepository> Repository { get; private set; } | |
protected ProductLogic Create() | |
{ | |
Repository = new Mock<IProductRepository>(); | |
return new ProductLogic(new Lazy<IProductRepository>(() => Repository.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
public class BaseTests : RepositoryTests | |
{ | |
protected ProductRepository Create(string path = null) | |
{ | |
var context = CreateContext(path); | |
return new ProductRepository(new Lazy<DataContext>(() => context)); | |
} | |
} |
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 BaseTest | |
{ | |
protected Mock<IProductLogic> Logic { get; set; } | |
protected Mock<IMapper> Mapper { get; set; } | |
protected virtual ProductsController Create() | |
{ | |
Logic = new Mock<IProductLogic>(); |
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 CsvFormatter : ICsvFormatter | |
{ | |
public void Export(Report report) | |
{ | |
Console.WriteLine($"CsvFormatter.Export: {report.Name}"); | |
} | |
} | |
public interface ICsvFormatter | |
{ |
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 Category | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
} |
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 Category | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public string Description { get; set; } | |
public virtual ICollection<Product> Products { get; set; } | |
} |
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 Product | |
{ | |
public int Id { get; set; } | |
public string Name { get; set; } | |
public string Category { get; set; } | |
public decimal Price { get; set; } | |
} |
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 HomeController : Controller | |
{ | |
private static ILogger _logger = NLog.LogManager.GetCurrentClassLogger(); | |
public ActionResult Index() | |
{ | |
_logger.Info("Home.Index started."); | |
Random random = new Random(); | |
var value = random.Next(1, 3); |
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 DownloadViewModel | |
{ | |
[Required] | |
public string Url { get; set; } | |
} |
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 DataContext : DbContext | |
{ | |
public DataContext() | |
: base("Name=DefaultConnection") | |
{ | |
} | |
public DbSet<Category> Categories { get; set; } |