public void TestMethod_DeleteAsync_NullEntity_Throws() { ICollaborationService service = _unityContainer.Resolve <ICollaborationService>(); Action act = () => service.Delete(null); AssertExtension.AssertInnerThrows <NullReferenceException>(act, "Nessuna eccezione di ritorno. Era attesa una NullReferenceException"); }
public async Task TestMethod_Delete_NotThrows() { ICollaborationService service = _unityContainer.Resolve <ICollaborationService>(); IDataUnitOfWork unitOfWork = _unityContainer.Resolve <IDataUnitOfWork>(); Collaboration collaboration = CustomElements.CreateCollaborationModel(); collaboration = service.Create(collaboration); await unitOfWork.SaveChangesAsync(); Collaboration collaborationToDelete = service.Queryable().FirstOrDefault(f => f.EntityId == CustomElements.CollaborationId); service.Delete(collaborationToDelete); await unitOfWork.SaveChangesAsync(); Collaboration collaborationDeleted = service.Queryable().FirstOrDefault(f => f.EntityId == CustomElements.CollaborationId); Assert.IsNull(collaborationDeleted); }