コード例 #1
0
ファイル: ContextTests.cs プロジェクト: ciscoheat/ivento-dci
            public void ShouldReturnTheCurrentContextIfRoleIsSameAsContextRole()
            {
                // Arrange
                var stack = new Stack();

                stack.Push(this);
                ContextAssertionTest = this;

                Context.Initialize.With(() => stack);

                // Act
                var current = Context.Current<TheCurrentAsMethod>(this, c => c.ContextAssertionTest);

                // Assert
                current.Should().Equal(this);
            }
コード例 #2
0
            public void ShouldReturnTheCurrentContextIfRoleIsSameAsContextRole()
            {
                // Arrange
                var stack = new Stack();

                stack.Push(this);
                ContextAssertionTest = this;

                Context.Initialize.With(() => stack);

                // Act
                var current = Context.Current <TheCurrentAsMethod>(this, c => c.ContextAssertionTest);

                // Assert
                current.Should().Equal(this);
            }
コード例 #3
0
            public void ShouldThrowExceptionIfRoleIsntSameAsContextRole()
            {
                // Arrange
                const string s     = "AnotherRole";
                var          stack = new Stack();

                stack.Push(this);
                ContextAssertionTest = this;

                Context.Initialize.With(() => stack);

                // Act
                var current = Context.Current <TheCurrentAsMethod>(s, c => c.ContextAssertionTest);

                // Assert
                current.Should().Equal(this);
            }
コード例 #4
0
ファイル: ContextTests.cs プロジェクト: ciscoheat/ivento-dci
            public void ShouldThrowExceptionIfRoleIsntSameAsContextRole()
            {
                // Arrange
                const string s = "AnotherRole";
                var stack = new Stack();

                stack.Push(this);
                ContextAssertionTest = this;

                Context.Initialize.With(() => stack);

                // Act
                var current = Context.Current<TheCurrentAsMethod>(s, c => c.ContextAssertionTest);

                // Assert
                current.Should().Equal(this);
            }