public async Task TestSave_FilterUpdateListByDeleteList() { var input = new List <DtoSample> { new DtoSample { Id = "1" } }; await _service.SaveAsync(DtoSample.EmptyList(), input, input); await _repository.DidNotReceive().UpdateAsync(Arg.Any <EntitySample>()); }
public void TestSave_FilterUpdateListByDeleteList() { var input = new List <DtoSample> { new DtoSample { Id = "1" } }; _service.Save(DtoSample.EmptyList(), input, input); _repository.DidNotReceive().Update(Arg.Any <EntitySample>()); }
public void TestSave_Delete_1() { var input = new List <DtoSample> { new DtoSample { Id = _id.ToString() } }; _service.Save(DtoSample.EmptyList(), DtoSample.EmptyList(), input); _repository.Received(1).Remove(Arg.Any <Guid>()); _repository.Received().Remove(Arg.Is <Guid>(id => id == _id)); }
public void TestSave_Add_1() { var input = new List <DtoSample> { new DtoSample { Id = _id.ToString() } }; _service.Save(input, DtoSample.EmptyList(), DtoSample.EmptyList()); _repository.Received(1).Add(Arg.Any <EntitySample>()); _repository.Received().Add(Arg.Is <EntitySample>(t => t.Id == _id)); }
public async Task TestSaveAsync_Delete_1() { var input = new List <DtoSample> { new DtoSample { Id = _id.ToString() } }; await _service.SaveAsync(DtoSample.EmptyList(), DtoSample.EmptyList(), input); await _repository.Received(1).RemoveAsync(Arg.Any <Guid>()); await _repository.Received().RemoveAsync(Arg.Is <Guid>(id => id == _id)); }
public async Task TestSaveAsync_Add_1() { var input = new List <DtoSample> { new DtoSample { Id = _id.ToString() } }; await _service.SaveAsync(input, DtoSample.EmptyList(), DtoSample.EmptyList()); await _repository.Received(1).AddAsync(Arg.Any <EntitySample>()); await _repository.Received().AddAsync(Arg.Is <EntitySample>(t => t.Id == _id)); }
public void TestSave_Update_1() { _repository.Find(_id).Returns(t => new EntitySample(_id)); var input = new List <DtoSample> { new DtoSample { Id = _id.ToString(), Name = "b" } }; _service.Save(DtoSample.EmptyList(), input, DtoSample.EmptyList()); _repository.Received(1).Update(Arg.Any <EntitySample>()); _repository.Received().Update(Arg.Is <EntitySample>(t => t.Id == _id && t.Name == "b")); }
public void TestSave_Update_Repeat() { _repository.Find(_id).Returns(t => new EntitySample(_id)); var input = new List <DtoSample> { new DtoSample { Id = _id.ToString() }, new DtoSample { Id = _id.ToString() } }; _service.Save(DtoSample.EmptyList(), input, DtoSample.EmptyList()); _repository.Received(1).Update(Arg.Any <EntitySample>()); }
public async Task TestSave_Update_Repeat() { _repository.FindAsync(_id).Returns(t => new EntitySample(_id)); var input = new List <DtoSample> { new DtoSample { Id = _id.ToString() }, new DtoSample { Id = _id.ToString() } }; await _service.SaveAsync(DtoSample.EmptyList(), input, DtoSample.EmptyList()); await _repository.Received(1).UpdateAsync(Arg.Any <EntitySample>()); }
public async Task TestSaveAsync_Update_1() { var entity = new EntitySample(_id); _repository.FindAsync(_id).Returns(t => entity); var input = new List <DtoSample> { new DtoSample { Id = _id.ToString(), Name = "b" } }; await _service.SaveAsync(DtoSample.EmptyList(), input, DtoSample.EmptyList()); await _repository.Received(1).UpdateAsync(Arg.Any <EntitySample>()); await _repository.Received().UpdateAsync(Arg.Is <EntitySample>(t => t.Id == _id && t.Name == "b")); }
public void TestSave_Add_Empty() { _service.Save(DtoSample.EmptyList(), DtoSample.EmptyList(), DtoSample.EmptyList()); _repository.DidNotReceive().Add(Arg.Any <EntitySample>()); }
public async Task TestSave_Empty() { await _service.SaveAsync(DtoSample.EmptyList(), DtoSample.EmptyList(), DtoSample.EmptyList()); await _repository.DidNotReceive().AddAsync(Arg.Any <EntitySample>()); }