예제 #1
0
        public void Test_React()
        {
            TestArticle article = CreateStrategy.New <TestArticle>(false).Create <TestArticle>();

            article.ID    = Guid.NewGuid();
            article.Title = "Test Article";

            MockSaveTestArticleStrategy strategy = MockSaveTestArticleStrategy.New(false);

            strategy.Save(article);

            Assert.IsTrue((bool)StateAccess.State.Session["MockSaveTestArticleReaction_Reacted"], "The reaction flag wasn't set to true.");
        }
        public static MockSaveTestArticleStrategy New(bool requiresAuthorisation)
        {
            MockSaveTestArticleStrategy strategy = new MockSaveTestArticleStrategy();
            strategy.TypeName = "TestArticle";
            strategy.RequireAuthorisation = requiresAuthorisation;

            StrategyState
                .Strategies
                .Creator
                .AttachReactions("Save", strategy);

            return strategy;
        }
        static public MockSaveTestArticleStrategy New(bool requiresAuthorisation)
        {
            MockSaveTestArticleStrategy strategy = new MockSaveTestArticleStrategy();

            strategy.TypeName             = "TestArticle";
            strategy.RequireAuthorisation = requiresAuthorisation;

            StrategyState
            .Strategies
            .Creator
            .AttachReactions("Save", strategy);

            return(strategy);
        }