Exemple #1
0
 public static string parseScenario(SCENARIO S)
 {
     if (S == SCENARIO.SALES)
     {
         return("B");
     }
     if (S == SCENARIO.PURCHASING)
     {
         return("A");
     }
     return(null);
 }
Exemple #2
0
        public void user_requests_a_sell()
        {
            SCENARIO["User trades stocks"] =
                DESCRIBE
                | "User requests a sell before close of trading" |
                GIVEN
                | "I have 100 shares of MSFT stock".MapAction(Have100SharesOfMsftStock) |
                WHEN
                | "I ask to sell 20 shares of MSFT stock".MapAction(AskToSell20SharesOfMsftStock) |
                THEN
                | "I should have 80 shares of MSFT stock".MapAction(ShouldHave80SharesOfMsftStock);

            SCENARIO.Execute().IsSuccess.Should().BeTrue();
        }
Exemple #3
0
        public void user_requests_a_sell_dynamic(int share, int sells, int total)
        {
            Let["share-value"] = share;
            Let["sells-value"] = sells;
            Let["total-value"] = total;

            SCENARIO["User trades stocks"] =
                DESCRIBE | "User requests a sell before close of trading" |
                GIVEN | "I have :share-value shares of MSFT stock" |
                WHEN | "I ask to sell :sells-value shares of MSFT stock" |
                THEN | "I should have :total-value shares of MSFT stock";

            Mapper.Setup_user_trades_stocks_scenario_dynamic();
            SCENARIO.Execute().IsSuccess.Should().BeTrue();
        }
Exemple #4
0
        public void user_requests_a_sell_before_close_of_trading()
        {
            SCENARIO["User trades stocks before close of trading"] =
                DESCRIBE | "User requests a sell before close of trading" |
                GIVEN
                | "I have 100 shares of MSFT stock" | AND
                | "I have 150 shares of APPL stock" | AND
                | "The time is before close of trading" |
                WHEN
                | "I ask to sell 20 shares of MSFT stock" |
                THEN
                | "I should have 150 shares of APPL stock" | AND
                | "I should have 80 shares of MSFT stock";

            Mapper.Setup_user_requests_a_sell_before_close_of_trading();
            SCENARIO.Execute().IsSuccess.Should().BeTrue();
        }
Exemple #5
0
        public static string getScenarioText(SCENARIO S)
        {
            switch (S)
            {
            case SCENARIO.FREE:
                return("Serbest Tartým");

            case SCENARIO.NULL:
                return(null);

            case SCENARIO.PURCHASING:
                return("Satýnalma");

            case SCENARIO.SALES:
                return("Satýþ");
            }

            return(null);
        }
Exemple #6
0
        public static Tartim[] getTartims(SCENARIO S)
        {
            Tartim[] ret;

            Program.sql.connect();
            Program.sql.initializeStoredProcedure("SP_TARTIM_GET_OPEN_BY_TARTI");
            Program.sql.addStoredProcedureParameter("@TARTI", parseScenario(S));
            DataTable dt = Program.sql.executeStoredProcedureReader();

            if (dt == null || dt.Rows.Count <= 0)
            {
                return(null);
            }

            ret = new Tartim[dt.Rows.Count];
            for (int n = 0; n < dt.Rows.Count; n++)
            {
                ret[n] = new Tartim(dt.Rows[n]);
            }

            return(ret);
        }