public async Task CreateAsync_NoteGroup() { var update = new NoteGroupUpdateModel(); update.Name = "test"; var identity = new NoteGroupIdentityModel(0); var expected = new NoteGroup(); expected.Name = "test"; //mock var noteDataAccess = new Mock <IDataAccessor <NoteGroup, INoteGroupIdentity, NoteGroupUpdateModel> >(); noteDataAccess.Setup(x => x.InsertAsync(update)).ReturnsAsync(expected); //setup var noteServices = new NoteGroupServices(noteDataAccess.Object); //action var result = await noteServices.CreateAsync(update); //result result.Should().Be(expected); }
public async Task GetAsync_NoteGroup() { var identity = new NoteGroupIdentityModel(0); //mock var noteDataAccess = new Mock <IDataAccessor <NoteGroup, INoteGroupIdentity, NoteGroupUpdateModel> >(); noteDataAccess.Setup(x => x.GetAsync(identity)).ReturnsAsync((NoteGroup)null); //setup var noteServices = new NoteGroupServices(noteDataAccess.Object); //action var result = await noteServices.GetAsync(identity); //result result.Should().Be(null); }