public void Map_TransferToDomain_Test() { //Arrange IDiagnosticsMapper mapper = new DiagnosticsMapper(); var transferDiagnostics = new TransferDiagnostics { DiagnosticsId = 1, Date = new DateTime(2015, 1, 1), EntityState = EntityState.Unchanged, ExceptionName = "NewException", Message = "Error", UserId = 1 }; var expectedDomainDiagnostics = new DomainDiagnosticsLikeness { DiagnosticsId = 1, Date = new DateTime(2015, 1, 1), EntityState = EntityState.Unchanged, ExceptionName = "NewException", Message = "Error", UserId = 1 }; //Act var actualDomainDiagnostics = mapper.Map(transferDiagnostics); //Assert Assert.That(actualDomainDiagnostics, Is.EqualTo(expectedDomainDiagnostics)); }
public void Post(TransferDiagnostics transferDiagnostic) { if (transferDiagnostic == null) { throw new ArgumentNullException("transferDiagnostic"); } var identity = (FormsIdentity)HttpContext.Current.User.Identity; var userId = _cookieParser.GetUserId(identity); Diagnostics diagnostic = _diagnosticsMapper.Map(transferDiagnostic); diagnostic.UserId = userId; _diagnosticsService.SaveDiagnosticAsync(diagnostic); }