Exemplo n.º 1
0
        public async Task CreateConversation_ShouldCreateConversationAndAddIdToMembersUserData()
        {
            // Arrange
            string expectedName = Constants.ConversationInfo1.Name;

            AuthServiceMock.Setup(authService => authService.CurrentUser).Returns(Constants.User1);

            // Act
            await MessagingService.CreateConversation(expectedName);

            // Assert
            // Verify that one (and only one) conversation with the correct info is added to the database.
            var conversations = await DatabaseServiceMock.Ref(DatabasePaths.Conversations)
                                .Once <Dictionary <string, ConversationModel> >();

            var conversation = conversations.First().Value;

            Assert.AreEqual(conversations.Count, 1);
            Assert.IsNotNull(conversation);
        }