public void DateTimeIntellisenseProvider_GetIntellisenseResults_ContextIsNull_ResultCountIsZero()
        {
            //------------Execute Test---------------------------
            var getResults = new DateTimeIntellisenseProvider().GetIntellisenseResults(null);

            //------------Assert Results-------------------------
            Assert.AreEqual(0, getResults.Count);
        }
 public void DateTimeIntellisenseProvider_InLiteralRegion_NotInRegion_ExpectFalse()
 {
     //------------Assert Results-------------------------
     Assert.IsFalse(DateTimeIntellisenseProvider.InLiteralRegion(@"2012/01/01", 1));
     Assert.IsFalse(DateTimeIntellisenseProvider.InLiteralRegion(@"2012/01/01", 0));
     Assert.IsFalse(DateTimeIntellisenseProvider.InLiteralRegion(@"2012/01/01", 10));
     Assert.IsFalse(DateTimeIntellisenseProvider.InLiteralRegion(@"2012\\01\01", 5));
     Assert.IsFalse(DateTimeIntellisenseProvider.InLiteralRegion(@"2012\\\''''01\01", 9));
 }
        public void DateTimeIntellisenseProvider_Construct_DefaultPropertiesAreSet()
        {
            var provider = new DateTimeIntellisenseProvider();

            Assert.IsFalse(provider.HandlesResultInsertion);
            Assert.AreEqual(IntellisenseProviderType.NonDefault, provider.IntellisenseProviderType);
            Assert.IsNotNull(provider.IntellisenseResults);
            Assert.AreEqual(24, provider.IntellisenseResults.Count);
            Assert.IsFalse(provider.Optional);
        }
        public void DateTimeIntellisenseProvider_Constructor_Create_ExpectCorrectMembers()
        {
            //------------Setup for test--------------------------
            var dateTimeIntellisenseProvider = new DateTimeIntellisenseProvider();



            //------------Assert Results-------------------------
            Assert.IsNotNull(dateTimeIntellisenseProvider.Optional);
            Assert.IsTrue(dateTimeIntellisenseProvider.IntellisenseResults.Count > 0);
        }
        public void DateTimeIntellisenseProvider_Dispose()
        {
            //------------Setup for test--------------------------
            var dateTimeIntellisenseProvider = new DateTimeIntellisenseProvider();

            dateTimeIntellisenseProvider.Dispose();


            //------------Assert Results-------------------------
            Assert.IsNull(dateTimeIntellisenseProvider.IntellisenseResults);
        }
        public void DateTimeIntellisenseProvider_GetIntellisenseResults_PartialMethodMatch_ClosestMatchesReturned()
        {
            var context = new IntellisenseProviderContext
            {
                CaretPosition     = 1,
                InputText         = "d",
                IsInCalculateMode = false,
                DesiredResultSet  = IntellisenseDesiredResultSet.ClosestMatch
            };

            var dateTimeIntellisenseProvider           = new DateTimeIntellisenseProvider();
            IList <IntellisenseProviderResult> results = dateTimeIntellisenseProvider.GetIntellisenseResults(context);

            Assert.AreEqual(6, results.Count);
        }
        public void DateTimeIntellisenseProvider_Constructor_Parameters_ExpectCorrectMembers()
        {
            //------------Setup for test--------------------------
            var res = new Mock <IIntellisenseResult>();

            res.Setup(a => a.ErrorCode).Returns(enIntellisenseErrorCode.InvalidRecordsetNotation);
            res.Setup(a => a.Type).Returns(enIntellisenseResultType.Error);
            res.Setup(a => a.IsClosedRegion).Returns(true);
            var dateTimeIntellisenseProvider = new DateTimeIntellisenseProvider(new List <IIntellisenseResult> {
                res.Object
            });

            //------------Assert Results-------------------------
            Assert.IsNotNull(dateTimeIntellisenseProvider.Optional);
            Assert.IsTrue(dateTimeIntellisenseProvider.IntellisenseResults.Count == 1);
            Assert.AreEqual(res.Object, dateTimeIntellisenseProvider.IntellisenseResults[0]);
        }
        public void DateTimeIntellisenseProvider_PerformInsertion_ExpectException()
        {
            //------------Setup for test--------------------------
            var context = new IntellisenseProviderContext
            {
                CaretPosition     = 1,
                InputText         = "d",
                IsInCalculateMode = false,
                DesiredResultSet  = IntellisenseDesiredResultSet.ClosestMatch
            };

            var dateTimeIntellisenseProvider = new DateTimeIntellisenseProvider();


            //------------Execute Test---------------------------

            dateTimeIntellisenseProvider.PerformResultInsertion("blah", context);

            //------------Assert Results-------------------------
        }
        public void DateTimeIntellisenseProvider_GetIntellisenseResultsImpl_EntireResultSet()
        {
            //------------Setup for test--------------------------
            var context = new IntellisenseProviderContext
            {
                CaretPosition     = 1,
                InputText         = "d",
                IsInCalculateMode = false,
                DesiredResultSet  = IntellisenseDesiredResultSet.EntireSet
            };

            var dateTimeIntellisenseProvider = new DateTimeIntellisenseProvider();
            var count = dateTimeIntellisenseProvider.IntellisenseResults.Count;

            //------------Execute Test---------------------------

            var results = dateTimeIntellisenseProvider.GetIntellisenseResultsImpl(context);

            //------------Assert Results-------------------------
            Assert.AreEqual(count, results.Count);
        }
 public void DateTimeIntellisenseProvider_InLiteralRegion_InRegion_ExpectTrue()
 {
     //------------Assert Results-------------------------
     Assert.IsTrue(DateTimeIntellisenseProvider.InLiteralRegion(@"2012\\\''01\01", 9));
 }