public async Task DeleteChannel_ChannelDeletion_ChannelDeleted(int ChannelId, int OwnerId, string ChannelName) { ChannelModel model = new ChannelModel(); model.OwnerId = OwnerId; model.Name = ChannelName; Mock <IMessagesRepo> messagesRepo = new Mock <IMessagesRepo>(); Mock <IChannelsRepo> channelsRepo = new Mock <IChannelsRepo>(); Mock <IUserAccountRepository> userAccountRepository = new Mock <IUserAccountRepository>(); Mock <IUserChannelsRepo> userChannelsRepo = new Mock <IUserChannelsRepo>(); IMessagingService messagingService = new MessagingService(messagesRepo.Object, channelsRepo.Object, userChannelsRepo.Object, userAccountRepository.Object); try { await messagingService.CreateChannelAsync(model); } catch { Assert.IsTrue(false); } try { await messagingService.DeleteChannelAsync(ChannelId); } catch { Assert.IsTrue(false); } Assert.IsTrue(true); }
public async Task DeleteChannel_ChannelDeletion_ChannelDeleted(int ChannelId, int OwnerId, string ChannelName) { ChannelModel model = new ChannelModel(); model.OwnerId = OwnerId; model.Name = ChannelName; IDataGateway dataGateway = new SQLServerGateway(); IConnectionStringData connectionString = new ConnectionStringData(); IMessagesRepo messagesRepo = new MessagesRepo(dataGateway, connectionString); IChannelsRepo channelsRepo = new ChannelsRepo(dataGateway, connectionString); IUserAccountRepository userAccountRepository = new UserAccountRepository(dataGateway, connectionString); IUserChannelsRepo userChannelsRepo = new UserChannelsRepo(dataGateway, connectionString); IMessagingService messagingService = new MessagingService(messagesRepo, channelsRepo, userChannelsRepo, userAccountRepository); try { await messagingService.CreateChannelAsync(model); } catch { Assert.IsTrue(false); } try { await messagingService.DeleteChannelAsync(ChannelId); } catch { Assert.IsTrue(false); } ChannelModel channelModel = await channelsRepo.GetChannelbyIdAsync(ChannelId); if (channelModel != null) { Assert.IsTrue(false); } Assert.IsTrue(true); }