public void Backlog_serive_Delete_method_throw_nullReferenceException() { UserStory backlog = new UserStory(); var mockrepo = new Mock <IBacklogRepository>(); mockrepo.Setup(x => x.Delete(It.IsAny <int>())).Throws(new NullReferenceException()); BacklogService obj = new BacklogService(mockrepo.Object); var exception = Record.Exception(() => obj.Delete(It.IsAny <int>())); Assert.IsType <NullReferenceException>(exception); }
public void Backlog_serive_Delete_method_throw_exception_with_invalid_value_type() { UserStory backlog = new UserStory(); var mockrepo = new Mock <IBacklogRepository>(); mockrepo.Setup(x => x.Delete(It.IsAny <int>())).Throws(new FormatException()); BacklogService obj = new BacklogService(mockrepo.Object); var exception = Record.Exception(() => obj.Delete(It.IsAny <int>())); Assert.IsType <FormatException>(exception); }