public async Task GetByName_FilterByDefaultLanguage_Success() { //Arrange var templatesRepository = new Mock<ITemplatesRepository>(); var templatesManager = new TemplatesManager(templatesRepository.Object); var searchingName = "tests template 1"; var entities = new List<Template> { new Template { Name = searchingName, Subject = "tests subject 1", HtmlBodyTemplate = "Hi my friend :)", PlainBodyTemplate = "test plain", Priority = EmailMessagePriority.Normal, Tag = "test tag", Language = "en", FromAddress = "*****@*****.**", CreatedDateTime = DateTime.UtcNow }, new Template { Name = searchingName, Subject = "tests subject 2", HtmlBodyTemplate = "Hi my friend :)", PlainBodyTemplate = "test plain", Priority = EmailMessagePriority.Low, Tag = "test tag from kirill)", Language = "es", FromAddress = "*****@*****.**", CreatedDateTime = DateTime.UtcNow }, new Template { Name = "tests template 2", Subject = "tests subject 2", HtmlBodyTemplate = "Hi my friend :)", PlainBodyTemplate = "test plain", Priority = EmailMessagePriority.High, Tag = "test tag)", Language = "ru", FromAddress = "*****@*****.**", CreatedDateTime = DateTime.UtcNow } }; //Expect templatesRepository .Setup(x => x.GetQuerable()) .Returns(new AsyncEnumerable<Template>(entities)); //Act var filteredTemplate = await templatesManager.GetByName(searchingName); //Assert Assert.IsNotNull(filteredTemplate); Assert.AreEqual(entities[0].Name, filteredTemplate.Name); Assert.AreEqual(entities[0].Subject, filteredTemplate.Subject); Assert.AreEqual(entities[0].HtmlBodyTemplate, filteredTemplate.HtmlBodyTemplate); Assert.AreEqual(entities[0].PlainBodyTemplate, filteredTemplate.PlainBodyTemplate); Assert.AreEqual(Priority.Normal, filteredTemplate.Priority); Assert.AreEqual(entities[0].Tag, filteredTemplate.Tag); Assert.AreEqual(entities[0].Language, filteredTemplate.Language.Name); Assert.AreEqual(entities[0].FromAddress, filteredTemplate.FromAddress); //Verify templatesRepository.VerifyAll(); }