コード例 #1
0
 public DataCleaner(NameValueCollection c)
 {
     Initialize(c);
     ForceValidation = false;
     _db = new DataCleanRespository(); 
     _msgDict = new ParseResultDictionary(_db.GetMelissaReference());
 }
コード例 #2
0
        public void CanGetParseDictionaryWarningsTest()
        {
            var db = new DataCleanRespository();
            var msgDict = new ParseResultDictionary(db.GetMelissaReference());
            Assert.IsTrue(msgDict.GetAllWarningMessages().Count() > 3);

        }
コード例 #3
0
        public void CanGetParseDictionaryTest()
        {
            var db = new DataCleanRespository();
            var msgDict = new ParseResultDictionary(db.GetMelissaReference());
            Assert.IsTrue(msgDict.Count > 300);

        }
コード例 #4
0
        public void CanDoLookupTest()
        {
            var db = new DataCleanRespository();
            var msgDict = new ParseResultDictionary(db.GetMelissaReference());
            var c = msgDict.LookupCode(PostalCodeErrorCode);
            Assert.IsTrue(c.Code == PostalCodeErrorCode);
            Assert.IsTrue(c.LongDescription.Length > 0 );

        }
コード例 #5
0
 public void CantSaveOutputDoesNotMatchInputTest()
 {
     var db = new DataCleanRespository();
     var e = new DataCleanEvent()
     {
         Input = TestData.GoodAddresstoClean,
         DataCleanDate = DateTime.Now,
          Output = _goodOutputStreetAddress
     };
     // output id does not match input
     var id = e.ID;
     try
     {
         db.SaveEvent(e);
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex.Message.Contains("id"));
     }
 }
コード例 #6
0
        public void CantSaveUncleanEventTest()
        {
            var db = new DataCleanRespository();
            var e = new DataCleanEvent()
            {
                Input = TestData.GoodAddresstoClean
                //DataCleanDate = DateTime.Now  

               // We dont want to save an event without a data clean date! 
            };
            var id = e.ID;
            try
            {
                db.SaveEvent(e);
            }
            catch( Exception ex)
            {
                Assert.IsTrue(ex.Message.Contains("date"));
            }
        }
コード例 #7
0
        public void CanSaveEventTest()
        {
            var testTime = DateTime.Now;
            var db = new DataCleanRespository();
            var e = new DataCleanEvent()
            {
                Input = TestData.GoodAddresstoClean,
                DataCleanDate = testTime,
                Output = _goodOutputStreetAddress

            };
            // if the output id does not match it will not resolve correctly when we combine the two after datacleaner is done
            //
            e.Output.ID = e.ID;

            var id = e.ID;
            db.SaveEvent(e);
            var d = db.GetEvent(e.ID);
            Assert.IsTrue(d.ID == e.ID);
            Assert.IsTrue(d.Output.ID == e.ID);
            Assert.IsTrue(d.Output.ID == e.Input.ID);
            Assert.IsTrue(d.DataCleanDate == testTime);
        }
コード例 #8
0
 public void CantSaveEmptyEventTest()
 {
     var db = new DataCleanRespository();
     var e = new DataCleanEvent();
     var id = e.ID;
     try
     {
         db.SaveEvent(e);
     }
     catch (Exception ex)
     {
         Assert.IsTrue(ex.Message.Contains("event"));
     }
 }
コード例 #9
0
        public void CantSaveWithoutOutputTest()
        {
            var db = new DataCleanRespository();
            var e = new DataCleanEvent()
            {
                DataCleanDate = DateTime.Now,
                Input = TestData.GoodAddresstoClean
            };
            var id = e.ID;
            try
            {

                db.SaveEvent(e);
            }
            catch (Exception ex)
            {
                Assert.IsTrue(ex.Message.Contains("output"));
            }
        }