public async Task CreateAsync_Note() { var update = new NoteUpdateModel(); update.Name = "test"; var identity = new NoteIdentityModel(0); var expected = new Note(); expected.Name = "test"; //mock var noteDataAccess = new Mock <IDataAccessor <Note, INoteIdentity, NoteUpdateModel> >(); noteDataAccess.Setup(x => x.InsertAsync(update)).ReturnsAsync(expected); var noteReminderGetService = new Mock <IGetService <NoteReminder, INoteReminderIdentity> >(); var noteReminderDeleteService = new Mock <IDeleteService <INoteReminderIdentity> >(); //setup var noteServices = new NoteServices(noteDataAccess.Object, noteReminderDeleteService.Object, noteReminderGetService.Object); //action var result = await noteServices.CreateAsync(update); //result result.Should().Be(expected); }
public async Task GetAsync_Note() { var identity = new NoteIdentityModel(0); //mock var noteDataAccess = new Mock <IDataAccessor <Note, INoteIdentity, NoteUpdateModel> >(); noteDataAccess.Setup(x => x.GetAsync(identity)).ReturnsAsync((Note)null); var noteReminderGetService = new Mock <IGetService <NoteReminder, INoteReminderIdentity> >(); var noteReminderDeleteService = new Mock <IDeleteService <INoteReminderIdentity> >(); //setup var noteServices = new NoteServices( noteDataAccess.Object, noteReminderDeleteService.Object, noteReminderGetService.Object); //action var result = await noteServices.GetAsync(identity); //result result.Should().Be(null); }