public void NoteAutoMap_EntityToDatabase_SuccessfulMapping() { Note note = new Note() { Id = NOTE_ID, CreatedBy = CREATED_BY_ID, CreatedOn = DateTime.Now, //Contacts = (IList<Contact>)NoteMockData.GetMockNoteswithSetups(mockRepository, 2), //Tags = (ICollection<Tag>)NoteMockData.GetMockNoteTagsWithSetups(mockRepository, 2) }; NotesDb notesDb = Mapper.Map <Note, NotesDb>(note); Assert.AreEqual(notesDb.NoteID, note.Id); Assert.AreEqual(notesDb.NoteDetails, note.Details); }
public void NoteAutoMAp_DatabaseToEntities_SuccessfulMapping() { NotesDb notesDb = new NotesDb() { NoteID = NOTE_ID, NoteDetails = "Sample Note", CreatedBy = CREATED_BY_ID, CreatedOn = DateTime.Now //Contacts = (ICollection<ContactsDb>)NoteMockData.GetMockNoteswithSetups(mockRepository, 2), //Tags = (IList<TagsDb>)NoteMockData.GetMockNoteTagsWithSetups(mockRepository, 2) }; Note note = Mapper.Map <NotesDb, Note>(notesDb); Assert.AreEqual(note.Id, notesDb.NoteID); Assert.AreEqual(note.Details, notesDb.NoteDetails); }
public NotesController(NotesDb database) { _database = database; }
public void Configure(IApplicationBuilder application, IWebHostEnvironment environment, NotesDb database) { if (_secrets.SeedData) { database.Database.EnsureDeleted(); database.Database.EnsureCreated(); } if (environment.IsDevelopment()) { application.UseDeveloperExceptionPage(); } else { application.UseHttpsRedirection(); } application .UseCors(AllowSpecificOrigins) .UseFileServer(new FileServerOptions { FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "../Notes.Client")), RequestPath = "/client", EnableDirectoryBrowsing = true }) .UseSwagger() .UseSwaggerUI(c => { c.SwaggerEndpoint("/swagger/v1/swagger.json", _apiInfo.Title); }) .UseRouting() .UseAuthentication() .UseAuthorization() .UseEndpoints(endpoints => endpoints.MapControllers()); }
public AnswersController(NotesDb database, Secrets secrets) { _database = database; _secrets = secrets; }
public BasicAuthenticationHandler(IOptionsMonitor <AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, ISystemClock clock, NotesDb database) : base(options, logger, encoder, clock) { _database = database; }