Exemple #1
0
        public void Setup()
        {
            output = "";
            semanticModelMemento = new AAAMemento();
            semanticModel = new AAA(semanticModelMemento);

            semanticModel.Text("A description of the semanticModel instance");

            semanticModel.Arrange("Arrange", () => output += "Arrange");

            semanticModel.Act("Act1", () => output += "Act1");

            semanticModel.Assert("Assert1", () => output += "Assert1");

            semanticModel.Act("Act2", () => output += "Act2");

            semanticModel.Assert("Assert2", () => output += "Assert2");
        }
Exemple #2
0
        public void Should_be_ble_to_execute_without_arrange()
        {
            var output = "";
            var newAAA = new AAA();
            newAAA.Act("Act1", () =>
                output += "Act1");
            newAAA.Assert("Assert1", () =>
                output += "Assert1");

            newAAA.Execute();

            output.ShouldBe("Act1Assert1");
        }
Exemple #3
0
        public void Should_not_be_able_to_do_assertions_without_at_least_one_act()
        {
            var newSemanticModel = new AAA();
            newSemanticModel.Arrange("Arrange", () => { });

            this.ShouldThrowException<SemanticModelException>(() =>
                newSemanticModel.Assert("Assert", () => { }), ex =>
                    ex.Message.ShouldBe("Can not assert without any acts specified"));
        }
Exemple #4
0
        public void Should_rearrange_for_every_acts()
        {
            var number = 0;

            var newAAA = new AAA();

            newAAA.Arrange("Set start value", () =>
                number = 1);

            newAAA.Act("Multiply with two", () =>
                number *= 2);
            newAAA.Assert("Value should be two", () =>
                number.ShouldBe(2));

            newAAA.Act("Multiply with four", () =>
                number *= 4);
            newAAA.Assert("Value should be four", () =>
                number.ShouldBe(4));

            newAAA.Execute();
        }