{"id":16368669,"url":"https://github.com/simoneb/linunit","last_synced_at":"2026-02-26T21:30:16.530Z","repository":{"id":535209,"uuid":"164487","full_name":"simoneb/linunit","owner":"simoneb","description":null,"archived":false,"fork":false,"pushed_at":"2009-04-03T12:45:53.000Z","size":320,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-31T07:13:21.608Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simoneb.png","metadata":{"files":{"readme":"Readme.cs","changelog":null,"contributing":null,"funding":null,"license":"license.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-03-31T19:50:44.000Z","updated_at":"2019-08-13T14:14:05.000Z","dependencies_parsed_at":"2022-07-16T14:00:34.733Z","dependency_job_id":null,"html_url":"https://github.com/simoneb/linunit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simoneb%2Flinunit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simoneb%2Flinunit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simoneb%2Flinunit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simoneb%2Flinunit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simoneb","download_url":"https://codeload.github.com/simoneb/linunit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239869221,"owners_count":19710485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T02:53:30.330Z","updated_at":"2026-02-26T21:30:16.430Z","avatar_url":"https://github.com/simoneb.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing NUnit.Framework;\n\nnamespace LinUnit.Tests\n{\n    /* Here's an example of what you can do with LinUnit\n     * You can write expressions in the C# language and let LinUnit evaluate them\n     * The difference with the classic constraint-based syntax is that extending the range of assertions you can\n     * perform no longer requires to modify the source code of the NUnit framework, but it's a matter of creating\n     * an extension method and call it. You can see it in action with Empty() method.\n    */\n    public class Examples\n    {\n        [Test]\n        public void Example()\n        {\n            true.Should(x =\u003e x == true);\n            false.Should(x =\u003e x == false);\n\n            const string somethig = \"something\";\n\n            somethig.Should(x =\u003e x.Contains(\"some\"));\n            somethig.Should(x =\u003e !x.Contains(\"also\"));\n            somethig.ToUpperInvariant().Should(x =\u003e !x.Contains(\"some\"));\n            somethig.Should(x =\u003e x.StartsWith(\"so\") \u0026\u0026 x.EndsWith(\"ing\") \u0026\u0026 x.Contains(\"meth\"));\n            somethig.Should(x =\u003e !x.StartsWith(\"ing\") \u0026\u0026 !x.EndsWith(\"so\") \u0026\u0026 !x.Contains(\"body\"));\n\n            var ints = new[] {1, 2, 3};\n\n            ints.Should(x =\u003e x.SequenceEqual(new[] {1, 2, 3}));\n            ints.Should(x =\u003e !x.SequenceEqual(new[] {3, 2, 1}));\n            ints.Should(x =\u003e x != null);\n            ints.Should(x =\u003e !x.Empty());\n            ints.Should(x =\u003e x.Contains(2) \u0026\u0026 !x.Contains(4));\n\n            \"\".Should(x =\u003e x.Empty());\n        }\n\n        [Test]\n        public void Exceptions()\n        {\n            var i = 0;\n\n            Action action_which_throws = () =\u003e { var a = 1/i; };\n            Func\u003cint\u003e safe_action = () =\u003e 1;\n\n            /* Check that some code throws an exception */\n            action_which_throws.ShouldThrow();\n\n            /* A specific exception type */\n            action_which_throws.ShouldThrow\u003cDivideByZeroException\u003e();\n\n            /* Applying arbitrary constraints to the exception thrown */\n            action_which_throws.ShouldThrow().Message.Should(x =\u003e x.Contains(\"zero\"));\n\n            /* A specific exception type and arbitrary constraints */\n            action_which_throws.ShouldThrow\u003cDivideByZeroException\u003e().InnerException.Should(x =\u003e x == null);\n\n            /* This should not throw */\n            safe_action.ShouldNotThrow();\n        }\n    }\n\n    public static class Enumerable\n    {\n        public static bool Empty\u003cT\u003e(this IEnumerable\u003cT\u003e value)\n        {\n            return !value.Any();\n        }\n    }\n}","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimoneb%2Flinunit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimoneb%2Flinunit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimoneb%2Flinunit/lists"}