예제 #1
0
        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");
        }
예제 #2
0
        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);
        }