Exemple #1
0
        public async Task TestIReturnSingleQuoteRandomAsync()
        {
            IReturnSingleQuote returnSingleQuote  = new ReturnSingleQuote();
            OptionsSingleQuote optionsSingleQuote = new OptionsSingleQuote();

            //settign options
            //source is memory.
            optionsSingleQuote.enumSourceOfData = RandomStuffGeneratorPrivate.Enums.EnumSourceOfData.DataBaseInMemory;
            //quote is random
            optionsSingleQuote.RandomQuote = true;

            QuoteCube quoteCube = await returnSingleQuote.ReturnASingleQuote(optionsSingleQuote);

            var actual   = quoteCube.OperationSuccessful;
            var expected = true;

            Assert.Equal(expected, actual);
        }
Exemple #2
0
        public async Task TestIReturnSingleQuoteRandomKnownIdentifierAsync()
        {
            IReturnSingleQuote returnSingleQuote  = new ReturnSingleQuote();
            OptionsSingleQuote optionsSingleQuote = new OptionsSingleQuote();

            //settign options
            //source is memory.
            optionsSingleQuote.enumSourceOfData = RandomStuffGeneratorPrivate.Enums.EnumSourceOfData.DataBaseInMemory;
            //quote is specific
            optionsSingleQuote.RandomQuote = false;
            //provide identifier
            optionsSingleQuote.QuoteIdentifierCompadre = "1";

            QuoteCube quoteCube = await returnSingleQuote.ReturnASingleQuote(optionsSingleQuote);

            var actual   = quoteCube.OperationSuccessful;
            var expected = true;

            Assert.Equal(expected, actual);
        }
        public async Task <ActionResult <QuoteCube> > GetASingleQuoteAsync()
        {
            var tempQuoteCube = new QuoteCube();
            IReturnSingleQuote returnSingleQuote  = new ReturnSingleQuote();
            OptionsSingleQuote optionsSingleQuote = new OptionsSingleQuote();

            //setting options
            optionsSingleQuote.enumSourceOfData = EnumSourceOfData.DataBaseInContext;
            //quote is random
            optionsSingleQuote.RandomQuote = true;
            //set the context.
            optionsSingleQuote.bloggingContext = _context;

            tempQuoteCube = await returnSingleQuote.ReturnASingleQuote(optionsSingleQuote);

            //add the general response
            var generalAPIResponse = new GeneralAPIResponse();

            generalAPIResponse.dateTimeOfResponse = DateTime.Now;
            tempQuoteCube.generalAPIResponse      = generalAPIResponse;

            return(tempQuoteCube);
        }