コード例 #1
0
ファイル: HostTests.cs プロジェクト: nbduong/Heleonix.Guard
        public static void When()
        {
            var result = false;

            AaaSpec.When("the method is called", () =>
            {
                Act(() =>
                {
                    result = Host.When(true);
                });

                Should("return the passed condition", () =>
                {
                    Assert.That(result, Is.True);
                });
            });
        }
コード例 #2
0
ファイル: HostTests.cs プロジェクト: nbduong/Heleonix.Guard
        public static void Throw()
        {
            ExceptionRaiser exceptionBuilder1 = null;
            ExceptionRaiser exceptionBuilder2 = null;

            AaaSpec.When("the property is called two times", () =>
            {
                Act(() =>
                {
                    exceptionBuilder1 = Host.Throw;
                    exceptionBuilder2 = Host.Throw;
                });

                Should($"return the single instance of the {nameof(ExceptionRaiser)}", () =>
                {
                    Assert.That(exceptionBuilder1, Is.EqualTo(exceptionBuilder2));
                });
            });
        }