Ardalis/upgrade1 (#44)

* Upgrading to netcore 2.0
Updating repository to support async options and refactoring to use it.

* Starting work on tracking customer orders feature.

* Cleaning up some bugs
Working on basket view component implementation

* Fixing up styles, especially for basket in header.
This commit is contained in:
Steve Smith
2017-08-28 12:15:18 -04:00
committed by GitHub
parent 19c10ed0e5
commit ed5d17672d
45 changed files with 1024 additions and 482 deletions

View File

@@ -1,47 +0,0 @@
using Infrastructure.FileSystem;
using Microsoft.AspNetCore.Hosting;
using System.IO;
using Xunit;
using Moq;
namespace IntegrationTests.Infrastructure.File
{
public class LocalFileImageServiceGetImageBytesById
{
private byte[] _testBytes = new byte[] { 0x01, 0x02, 0x03 };
private readonly Mock<IHostingEnvironment> _mockEnvironment = new Mock<IHostingEnvironment>();
private int _testImageId = 123;
private string _testFileName = "123.png";
public LocalFileImageServiceGetImageBytesById()
{
// create folder if necessary
Directory.CreateDirectory(Path.Combine(GetFileDirectory(), "Pics"));
string filePath = GetFilePath(_testFileName);
System.IO.File.WriteAllBytes(filePath, _testBytes);
_mockEnvironment.SetupGet<string>(m => m.ContentRootPath).Returns(GetFileDirectory());
}
private string GetFilePath(string fileName)
{
return Path.Combine(GetFileDirectory(), "Pics", fileName);
}
private string GetFileDirectory()
{
var location = System.Reflection.Assembly.GetEntryAssembly().Location;
return Path.GetDirectoryName(location);
}
[Fact]
public void ReturnsFileContentResultGivenValidId()
{
var fileService = new LocalFileImageService(_mockEnvironment.Object);
var result = fileService.GetImageBytesById(_testImageId);
Assert.Equal(_testBytes, result);
}
}
}

View File

@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
<PackageReference Include="Moq" Version="4.7.49" />
<PackageReference Include="Moq" Version="4.7.99" />
</ItemGroup>