public async Task Create_Success() { //Arrange var templatesRepository = new Mock<ITemplatesRepository>(); var templatesManager = new TemplatesManager(templatesRepository.Object); var expectedTemplate = new DefaultTemplate { Name = "test template", Subject = "test subject", HtmlBodyTemplate = "Hi, it's your email", PlainBodyTemplate = "test plain", Priority = Priority.Normal, Tag = "tag test", Language = CultureInfo.CurrentCulture, FromAddress = "*****@*****.**" }; Template actualTemplate = null; //Expect templatesRepository .Setup(x => x.CreateAsync(It.IsNotNull<Template>())) .Callback<Template>(template => { actualTemplate = template; }) .Returns(Task.CompletedTask); //Act await templatesManager.Create(expectedTemplate); //Assert Assert.IsNotNull(actualTemplate); Assert.AreEqual(expectedTemplate.Name, actualTemplate.Name); Assert.AreEqual(expectedTemplate.Subject, actualTemplate.Subject); Assert.AreEqual(expectedTemplate.HtmlBodyTemplate, actualTemplate.HtmlBodyTemplate); Assert.AreEqual(expectedTemplate.PlainBodyTemplate, actualTemplate.PlainBodyTemplate); Assert.AreEqual(EmailMessagePriority.Normal, actualTemplate.Priority); Assert.AreEqual(expectedTemplate.Tag, actualTemplate.Tag); Assert.AreEqual(expectedTemplate.Language.Name, actualTemplate.Language); Assert.AreEqual(expectedTemplate.FromAddress, actualTemplate.FromAddress); //Verify templatesRepository.VerifyAll(); }