コード例 #1
0
        public void ReadNonMadridMessageFromDatabaseTest()
        {
            const string messageContentsExpected  = "Yo what up li'l mama. It's ya boy yunky.";
            const string phoneNumberValueExpected = "212-555-5688";
            bool         isOutgoingExpected       = true;
            long         flagsExpected            = TextMessageReaderTest.MessageFlagsAsLong(isOutgoingExpected);

            MockTextDatabaseReader2 mockDatabase = new MockTextDatabaseReader2();

            mockDatabase.AddNonMadridRow(9,
                                         phoneNumberValueExpected,
                                         1325519337,
                                         messageContentsExpected,
                                         flagsExpected,
                                         CountryCallingCodeFinder.CountryAbbreviationUnitedStates);

            TextMessage messageActual = SingleMessageFromDatabase(mockDatabase);

            Assert.AreEqual(phoneNumberValueExpected, messageActual.Address);
            Assert.AreEqual(messageContentsExpected, messageActual.MessageContents);
            Assert.AreEqual(isOutgoingExpected, messageActual.IsOutgoing);

            DateTime timestampExpected = new DateTime(2012, 1, 2, 10, 48, 57);

            Assert.AreEqual(timestampExpected, messageActual.Timestamp);
        }
コード例 #2
0
        public static TextMessage SingleMessageFromDatabase(IDatabaseReader databaseReader)
        {
            TextMessageReader2 messageReader = new TextMessageReader2(null);

            messageReader.ParseDatabase(databaseReader);
            Assert.AreEqual(1, messageReader.ItemCountEstimate);
            return(TextMessageReaderTest.SingleMessageFromReader(messageReader));
        }