public void ParseItemFromDatabaseTest()
        {
            MockChatRoomDatabaseReader mockDatabaseReader = new MockChatRoomDatabaseReader();
            mockDatabaseReader.AddRow("chat901258305184729544", _ParticipantsData);
            ChatRoomInformationReader_Accessor target = new ChatRoomInformationReader_Accessor();
            target.ParseDatabase(mockDatabaseReader);

            ChatRoomInformation expected = new ChatRoomInformation("chat901258305184729544", new string[] { "+15402392304", "+12068189288" });
            ChatRoomInformation actual = target.ParseItemFromDatabase(mockDatabaseReader);
            Assert.AreEqual(expected, actual);
        }
예제 #2
0
        public bool Equals(ChatRoomInformation other)
        {
            if (this.ChatId != other.ChatId)
            {
                return(false);
            }

            if (!Enumerable.SequenceEqual(this.Participants, other.Participants))
            {
                return(false);
            }

            return(true);
        }
예제 #3
0
        public bool Equals(ChatRoomInformation other)
        {
            if (this.ChatId != other.ChatId)
            {
                return false;
            }

            if (!Enumerable.SequenceEqual(this.Participants, other.Participants))
            {
                return false;
            }

            return true;
        }
        private static void InitChatRoomInfoItems()
        {
            int chatRoomInfoItemCount = Enum.GetValues(typeof(DummyChatRoomId)).Length;
            ChatRoomInformation[] dummyChatRoomInfoItems = new ChatRoomInformation[chatRoomInfoItemCount];

            {
                DummyChatRoomId chatId = DummyChatRoomId.ChatRoomA;
                string[] participants = {
                                            GetPhoneNumber(DummyPhoneNumberId.ObamaCell),
                                            GetPhoneNumber(DummyPhoneNumberId.AnthonyWeinerCell)
                                        };

                dummyChatRoomInfoItems[(int)chatId] = new ChatRoomInformation("chat901258305184729544", participants);
            }

            {
                DummyChatRoomId chatId = DummyChatRoomId.ChatRoomB;
                string[] participants = {
                                            GetPhoneNumber(DummyPhoneNumberId.TonyWolfCell),
                                            GetPhoneNumber(DummyPhoneNumberId.VictoriaWolfCell)
                                        };

                dummyChatRoomInfoItems[(int)chatId] = new ChatRoomInformation("chat901258305184729566", participants);
            }

            {
                DummyChatRoomId chatId = DummyChatRoomId.ChatRoomC;
                string[] participants = {
                                            GetPhoneNumber(DummyPhoneNumberId.ObamaCell),
                                            GetPhoneNumber(DummyPhoneNumberId.HarryLooseTieCell),
                                            GetPhoneNumber(DummyPhoneNumberId.AnthonyWeinerCell),
                                            GetPhoneNumber(DummyPhoneNumberId.ReliableLarryOffice)
                                        };

                dummyChatRoomInfoItems[(int)chatId] = new ChatRoomInformation("chat901258305184725792", participants);
            }

            {
                DummyChatRoomId chatId = DummyChatRoomId.ChatRoomD;
                string[] participants = {
                                            GetPhoneNumber(DummyPhoneNumberId.HarryLooseTieCell),
                                            GetPhoneNumber(DummyPhoneNumberId.UnknownLawnmower)
                                        };

                dummyChatRoomInfoItems[(int)chatId] = new ChatRoomInformation("chat901258305184724753", participants);
            }

            foreach (ChatRoomInformation cri in dummyChatRoomInfoItems)
            {
                if (cri == null)
                {
                    throw new ArgumentException("You forgot to initialize a chat room information item.");
                }
            }

            _DummyChatRoomInfoItems = dummyChatRoomInfoItems;
        }