Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Add tests
supportedd51804f9b5
diff --git a/src/Tests/Grand.Business.Customers.Tests/Grand.Business.Customers.Tests.csproj b/src/Tests/Grand.Business.Customers.Tests/Grand.Business.Customers.Tests.csprojindex 36fce0a4e..edc76195f 100644--- a/src/Tests/Grand.Business.Customers.Tests/Grand.Business.Customers.Tests.csproj+++ b/src/Tests/Grand.Business.Customers.Tests/Grand.Business.Customers.Tests.csproj@@ -17,9 +17,11 @@</ItemGroup><ItemGroup>+ <ProjectReference Include="..\..\Business\Grand.Business.Common\Grand.Business.Common.csproj" /><ProjectReference Include="..\..\Business\Grand.Business.Core\Grand.Business.Core.csproj" /><ProjectReference Include="..\..\Business\Grand.Business.Customers\Grand.Business.Customers.csproj" /><ProjectReference Include="..\Grand.Data.Tests\Grand.Data.Tests.csproj" />+ <ProjectReference Include="..\Grand.Infrastructure.Tests\Grand.Infrastructure.Tests.csproj" /></ItemGroup></Project>diff --git a/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetCustomerQueryHandlerTests.cs b/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetCustomerQueryHandlerTests.csnew file mode 100644index 000000000..b4ddf0042--- /dev/null+++ b/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetCustomerQueryHandlerTests.cs@@ -0,0 +1,35 @@+using Grand.Data.Tests.MongoDb;+using Grand.Domain.Customers;+using Microsoft.VisualStudio.TestTools.UnitTesting;++namespace Grand.Business.Customers.Queries.Handlers.Tests+{+ [TestClass()]+ public class GetCustomerQueryHandlerTests+ {+ private GetCustomerQueryHandler handler;++ [TestInitialize()]+ public void Init()+ {+ var _repository = new MongoDBRepositoryTest<Customer>();+ _repository.Insert(new Customer());+ _repository.Insert(new Customer());+ _repository.Insert(new Customer());+ _repository.Insert(new Customer());+ handler = new GetCustomerQueryHandler(_repository);+ }++ [TestMethod()]+ public async Task HandleTest()+ {+ //Assert+ var customerQuery = new Core.Queries.Customers.GetCustomerQuery();+ //Act+ var result = await handler.Handle(customerQuery, CancellationToken.None);++ //Assert+ Assert.AreEqual(4, result.Count());+ }+ }+}\ No newline at end of filediff --git a/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetGroupBySystemNameQueryHandlerTests.cs b/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetGroupBySystemNameQueryHandlerTests.csnew file mode 100644index 000000000..e8505d41b--- /dev/null+++ b/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetGroupBySystemNameQueryHandlerTests.cs@@ -0,0 +1,33 @@+using Grand.Business.Core.Interfaces.Common.Directory;+using Microsoft.VisualStudio.TestTools.UnitTesting;+using Moq;++namespace Grand.Business.Customers.Queries.Handlers.Tests+{+ [TestClass()]+ public class GetGroupBySystemNameQueryHandlerTests+ {+ private Mock<IGroupService> _groupServiceMock;+ private GetGroupBySystemNameQueryHandler handler;++ [TestInitialize()]+ public void Init()+ {+ _groupServiceMock = new Mock<IGroupService>();+ handler = new GetGroupBySystemNameQueryHandler(_groupServiceMock.Object);+ }++ [TestMethod()]+ public async Task HandleTest()+ {+ //Assert+ var groupBySystemNameQuery = new Core.Queries.Customers.GetGroupBySystemNameQuery();+ groupBySystemNameQuery.SystemName = "sample";++ //Act+ _ = await handler.Handle(groupBySystemNameQuery, CancellationToken.None);+ //Assert+ _groupServiceMock.Verify(c => c.GetCustomerGroupBySystemName(It.IsAny<string>()), Times.Once);+ }+ }+}\ No newline at end of filediff --git a/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetPasswordIsExpiredQueryHandlerTests.cs b/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetPasswordIsExpiredQueryHandlerTests.csnew file mode 100644index 000000000..adc97773d--- /dev/null+++ b/src/Tests/Grand.Business.Customers.Tests/Queries/Handlers/GetPasswordIsExpiredQueryHandlerTests.cs@@ -0,0 +1,40 @@+using Grand.Business.Core.Interfaces.Common.Directory;+using Grand.Domain.Customers;+using Microsoft.VisualStudio.TestTools.UnitTesting;+using Moq;++namespace Grand.Business.Customers.Queries.Handlers.Tests+{+ [TestClass()]+ public class GetPasswordIsExpiredQueryHandlerTests+ {+ private Mock<IGroupService> _groupServiceMock;+ private GetPasswordIsExpiredQueryHandler handler;++ [TestInitialize()]+ public void Init()+ {+ _groupServiceMock = new Mock<IGroupService>();+ handler = new GetPasswordIsExpiredQueryHandler(_groupServiceMock.Object, new Domain.Customers.CustomerSettings() { PasswordLifetime = 10 });+ }++ [TestMethod()]+ public async Task HandleTest()+ {+ //Assert+ var cr = new CustomerGroup() { Active = true, EnablePasswordLifetime = true };+ var cgs = new List<CustomerGroup>() { cr };+ _groupServiceMock.Setup(c => c.GetAllByIds(It.IsAny<string[]>()))+ .Returns(Task.FromResult<IList<CustomerGroup>>(cgs));++ var passwordIsExpiredQuery = new Core.Queries.Customers.GetPasswordIsExpiredQuery();+ var customer = new Customer() { Email = "[email protected]" };+ customer.Groups.Add(cr.Id);+ passwordIsExpiredQuery.Customer = customer;+ //Act+ var result = await handler.Handle(passwordIsExpiredQuery, CancellationToken.None);+ //Assert+ Assert.IsTrue(result);+ }+ }+}\ No newline at end of filediff --git a/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.csnew file mode 100644index 000000000..87ff633c1--- /dev/null+++ b/src/Tests/Grand.Business.Customers.Tests/Services/CustomerServiceTests.cs@@ -0,0 +1,450 @@+using Grand.Business.Common.Services.Directory;+using Grand.Business.Core.Interfaces.Common.Directory;+using Grand.Business.Core.Queries.Customers;+using Grand.Data.Tests.MongoDb;+using Grand.Domain;+using Grand.Domain.Common;+using Grand.Domain.Customers;+using Grand.Domain.Data;+using Grand.Domain.Orders;+using MediatR;+using Microsoft.VisualStudio.TestTools.UnitTesting;+using Moq;++namespace Grand.Business.Customers.Services.Tests+{+ [TestClass()]+ public class CustomerServiceTests+ {+ private IRepository<Customer> _repository;+ private Mock<IMediator> _mediatorMock;+ private IUserFieldService _userFieldService;+ private CustomerService _customerService;+ [TestInitialize()]+ public void TestInitialize()+ {+ _repository = new MongoDBRepositoryTest<Customer>();+ _mediatorMock = new Mock<IMediator>();+ _userFieldService = new UserFieldService(new MongoDBRepositoryTest<UserFieldBaseEntity>());++ _customerService = new CustomerService(_repository, _userFieldService, _mediatorMock.Object);+ }+++ [TestMethod()]+ public async Task GetOnlineCustomersTest()+ {+ //Assert+ await _repository.InsertAsync(new Customer() { LastActivityDateUtc = DateTime.UtcNow.AddDays(-1) });+ await _repository.InsertAsync(new Customer() { LastActivityDateUtc = DateTime.UtcNow });+ await _repository.InsertAsync(new Customer() { LastActivityDateUtc = DateTime.UtcNow });+ //Act+ var result = await _customerService.GetOnlineCustomers(DateTime.UtcNow.AddMinutes(-1), null);+ //Assert+ Assert.AreEqual(2, result.Count);+ }++ [TestMethod()]+ public async Task GetCountOnlineShoppingCartTest()+ {+ //Assert+ await _repository.InsertAsync(new Customer() { LastActivityDateUtc = DateTime.UtcNow.AddDays(-1) });+ await _repository.InsertAsync(new Customer() { LastActivityDateUtc = DateTime.UtcNow });+ var customer = new Customer() { LastUpdateCartDateUtc = DateTime.UtcNow, Active = true };+ customer.ShoppingCartItems.Add(new Domain.Orders.ShoppingCartItem() { CreatedOnUtc = DateTime.UtcNow, ShoppingCartTypeId = Domain.Orders.ShoppingCartType.ShoppingCart });+ await _repository.InsertAsync(customer);+ //Act+ var result = await _customerService.GetCountOnlineShoppingCart(DateTime.UtcNow.AddMinutes(-1), null);+ //Assert+ Assert.AreEqual(1, result);+ }++ [TestMethod()]+ public async Task GetCustomerByIdTest()+ {+ //Assert+ await _repository.InsertAsync(new Customer() { Id = "1" });+ //Act+ var result = await _customerService.GetCustomerById("1");+ //Assert+ Assert.IsNotNull(result);+ }++ [TestMethod()]+ public async Task GetCustomersByIdsTest()+ {+ //Assert+ await _repository.InsertAsync(new Customer() { Id = "1" });+ await _repository.InsertAsync(new Customer() { Id = "2" });+ await _repository.InsertAsync(new Customer() { Id = "3" });+ //Act+ var result = await _customerService.GetCustomersByIds(new[] { "1", "2" });+ //Assert+ Assert.AreEqual(2, result.Count);+ }++ [TestMethod()]+ public async Task GetCustomerByGuidTest()+ {+ //Assert+ var guid = Guid.NewGuid();+ await _repository.InsertAsync(new Customer() { CustomerGuid = guid });+ //Act+ var result = await _customerService.GetCustomerByGuid(guid);+ //Assert+ Assert.IsNotNull(result);+ }++ [TestMethod()]+ public async Task GetCustomerByEmailTest()+ {+ //Assert+ var email = "[email protected]";+ await _repository.InsertAsync(new Customer() { Email = email });+ //Act+ var result = await _customerService.GetCustomerByEmail(email);+ //Assert+ Assert.IsNotNull(result);+ }++ [TestMethod()]+ public async Task GetCustomerBySystemNameTest()+ {+ //Assert+ var systemName = "sample";+ await _repository.InsertAsync(new Customer() { SystemName = systemName });+ //Act+ var result = await _customerService.GetCustomerBySystemName(systemName);+ //Assert+ Assert.IsNotNull(result);+ }++ [TestMethod()]+ public async Task GetCustomerByUsernameTest()+ {+ //Assert+ var userName = "user";+ await _repository.InsertAsync(new Customer() { Username = userName });+ //Act+ var result = await _customerService.GetCustomerByUsername(userName);+ //Assert+ Assert.IsNotNull(result);+ }++ [TestMethod()]+ public async Task InsertGuestCustomerTest()+ {+ //Arrange+ var cg = new CustomerGroup();+ _mediatorMock.Setup(x => x.Send(It.IsAny<GetGroupBySystemNameQuery>(), default))+ .Returns(Task.FromResult(cg));++ //Act+ await _customerService.InsertGuestCustomer(new Domain.Stores.Store() { Id = "1" });+ //Assert+ Assert.IsTrue(_repository.Table.Any());+ Assert.IsTrue(_repository.Table.Where(x => x.StoreId == "1").Any());+ }++ [TestMethod()]+ public async Task InsertCustomerTest()+ {+ //Act+ await _customerService.InsertCustomer(new Customer());+ //Assert+ Assert.IsTrue(_repository.Table.Any());+ }++ [TestMethod()]+ public async Task UpdateCustomerFieldTest()+ {+ //Assert+ var customer = new Customer() { Email = "[email protected]" };+ await _repository.InsertAsync(customer);+ //Act+ await _customerService.UpdateCustomerField(customer, x => x.Email, "[email protected]");+ //Assert+ Assert.AreEqual("[email protected]", _repository.Table.FirstOrDefault(x => x.Id == customer.Id).Email);+ }++ [TestMethod()]+ public async Task UpdateCustomerFieldTest_Type()+ {+ //Assert+ var customer = new Customer() { Email = "[email protected]" };+ await _repository.InsertAsync(customer);+ //Act+ await _customerService.UpdateCustomerField<string>(customer, x => x.Username, "username");+ //Assert+ Assert.AreEqual("username", _repository.Table.FirstOrDefault(x => x.Id == customer.Id).Username);+ }++ [TestMethod()]+ public async Task UpdateCustomerTest()+ {+ //Assert+ var customer = new Customer() { Email = "[email protected]" };+ await _repository.InsertAsync(customer);+ //Act+ customer.Email = "[email protected]";+ await _customerService.UpdateCustomer(customer);+ //Assert+ Assert.AreEqual("[email protected]", _repository.Table.FirstOrDefault(x => x.Id == customer.Id).Email);+ }++ [TestMethod()]+ public async Task DeleteCustomerTest()+ {+ //Assert+ var customer = new Customer() { Email = "[email protected]" };+ await _repository.InsertAsync(customer);+ //Act+ await _customerService.DeleteCustomer(customer);+ //Assert+ Assert.IsTrue(_repository.Table.FirstOrDefault(x=>x.Id == customer.Id).Deleted);+ }++ [TestMethod()]+ public async Task DeleteCustomerTest_Hard()+ {+ //Assert+ var customer = new Customer() { Email = "[email protected]" };+ await _repository.InsertAsync(customer);+ //Act+ await _customerService.DeleteCustomer(customer, true);+ //Assert+ Assert.IsFalse(_repository.Table.Any());+ }++ [TestMethod()]+ public async Task UpdateCustomerLastLoginDateTest()+ {+ //Assert+ var customer = new Customer() { Email = "[email protected]" };+ await _repository.InsertAsync(customer);+ //Act+ var date = DateTime.UtcNow;+ customer.LastLoginDateUtc = date;+ await _customerService.UpdateCustomerLastLoginDate(customer);+ //Assert+ Assert.AreEqual(date.ToString(), _repository.Table.FirstOrDefault(x => x.Id == customer.Id).LastLoginDateUtc.ToString());+ }++ [TestMethod()]+ public async Task UpdateCustomerinAdminPanelTest()+ {+ //Assert+ var customer = new Customer() { Email = "[email protected]" };+ await _repository.InsertAsync(customer);+ //Act+ customer.AdminComment = "test";+ await _customerService.UpdateCustomerinAdminPanel(customer);+ //Assert+ Assert.AreEqual("test", _repository.Table.FirstOrDefault(x => x.Id == customer.Id).AdminComment);++ }++ [TestMethod()]+ public async Task UpdateActiveTest()+ {+ //Assert+ var customer = new Customer() { Email = "[email protected]", Active = true };+ await _repository.InsertAsync(customer);+ //Act+ customer.Active = false;+ await _customerService.UpdateActive(customer);+ //Assert+ Assert.AreEqual(false, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).Active);+ }++ [TestMethod()]+ public async Task UpdateContributionsTest()+ {+ //Assert+ var customer = new Customer() { Email = "[email protected]" };+ await _repository.InsertAsync(customer);+ //Act+ customer.Active = false;+ await _customerService.UpdateContributions(customer);+ //Assert+ Assert.AreEqual(true, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).HasContributions);+ }++ [TestMethod()]+ public async Task DeleteGuestCustomersTest()+ {+ //Arrange+ var cg = new CustomerGroup();+ _mediatorMock.Setup(x => x.Send(It.IsAny<GetGroupBySystemNameQuery>(), default))+ .Returns(Task.FromResult(cg));++ var customer = new Customer() { };+ customer.Groups.Add(cg.Id);+ await _repository.InsertAsync(customer);+ var customer2 = new Customer() { };+ customer2.Groups.Add("1");+ await _repository.InsertAsync(customer2);+ //Act+ await _customerService.DeleteGuestCustomers(null, null, onlyWithoutShoppingCart: false);+ //Assert+ Assert.AreEqual(1, _repository.Table.Count());+ }++ [TestMethod()]+ public async Task DeleteCustomerGroupInCustomerTest()+ {+ //Arrange+ var cg = new CustomerGroup();+ var customer = new Customer();+ customer.Groups.Add(cg.Id);+ await _repository.InsertAsync(customer);+ //Act+ await _customerService.DeleteCustomerGroupInCustomer(cg, customer.Id);+ //Assert+ Assert.AreEqual(0, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).Groups.Count);+ }++ [TestMethod()]+ public async Task InsertCustomerGroupInCustomerTest()+ {+ //Arrange+ var cg = new CustomerGroup();+ var customer = new Customer();+ await _repository.InsertAsync(customer);+ //Act+ await _customerService.InsertCustomerGroupInCustomer(cg, customer.Id);+ //Assert+ Assert.AreEqual(1, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).Groups.Count);+ }++ [TestMethod()]+ public async Task DeleteAddressTest()+ {+ //Arrange+ var address = new Address();+ var customer = new Customer();+ customer.Addresses.Add(address);+ await _repository.InsertAsync(customer);+ //Act+ await _customerService.DeleteAddress(address, customer.Id);+ //Assert+ Assert.AreEqual(0, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).Addresses.Count);+ }++ [TestMethod()]+ public async Task InsertAddressTest()+ {+ //Arrange+ var customer = new Customer();+ await _repository.InsertAsync(customer);+ //Act+ var address = new Address();+ await _customerService.InsertAddress(address, customer.Id);+ //Assert+ Assert.AreEqual(1, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).Addresses.Count);+ }++ [TestMethod()]+ public async Task UpdateAddressTest()+ {+ //Arrange+ var address = new Address();+ var customer = new Customer();+ customer.Addresses.Add(address);+ await _repository.InsertAsync(customer);+ //Act+ address.Name = "sample";+ await _customerService.UpdateAddress(address, customer.Id);+ //Assert+ Assert.AreEqual(1, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).Addresses.Count);+ Assert.AreEqual("sample", _repository.Table.FirstOrDefault(x => x.Id == customer.Id).Addresses.FirstOrDefault(x => x.Id == address.Id).Name);+ }++ [TestMethod()]+ public async Task UpdateBillingAddressTest()+ {+ //Arrange+ var customer = new Customer();+ await _repository.InsertAsync(customer);+ //Act+ var address = new Address();+ address.Name = "BillingAddress";+ await _customerService.UpdateBillingAddress(address, customer.Id);+ //Assert+ Assert.AreEqual("BillingAddress", _repository.Table.FirstOrDefault(x => x.Id == customer.Id).BillingAddress.Name);+ }++ [TestMethod()]+ public async Task UpdateShippingAddressTest()+ {+ //Arrange+ var customer = new Customer();+ await _repository.InsertAsync(customer);+ //Act+ var address = new Address();+ address.Name = "ShippingAddress";+ await _customerService.UpdateShippingAddress(address, customer.Id);+ //Assert+ Assert.AreEqual("ShippingAddress", _repository.Table.FirstOrDefault(x => x.Id == customer.Id).ShippingAddress.Name);+ }++ [TestMethod()]+ public async Task DeleteShoppingCartItemTest()+ {+ //Arrange+ var customer = new Customer();+ var cart = new ShoppingCartItem();+ customer.ShoppingCartItems.Add(cart);+ await _repository.InsertAsync(customer);+ //Act+ await _customerService.DeleteShoppingCartItem(customer.Id, cart);+ //Assert+ Assert.AreEqual(0, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).ShoppingCartItems.Count);+ }++ [TestMethod()]+ public async Task ClearShoppingCartItemTest()+ {+ //Arrange+ var customer = new Customer();+ var cart = new ShoppingCartItem();+ var cart2 = new ShoppingCartItem();+ customer.ShoppingCartItems.Add(cart);+ customer.ShoppingCartItems.Add(cart2);+ await _repository.InsertAsync(customer);+ //Act+ await _customerService.ClearShoppingCartItem(customer.Id, new List<ShoppingCartItem>() { cart });+ //Assert+ Assert.AreEqual(1, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).ShoppingCartItems.Count);+ }++ [TestMethod()]+ public async Task InsertShoppingCartItemTest()+ {+ //Arrange+ var customer = new Customer();+ await _repository.InsertAsync(customer);+ //Act+ var cart = new ShoppingCartItem();+ await _customerService.InsertShoppingCartItem(customer.Id, cart);+ //Assert+ Assert.AreEqual(1, _repository.Table.FirstOrDefault(x => x.Id == customer.Id).ShoppingCartItems.Count);++ }++ [TestMethod()]+ public async Task UpdateShoppingCartItemTest()+ {+ //Arrange+ var customer = new Customer();+ var cart = new ShoppingCartItem();+ customer.ShoppingCartItems.Add(cart);+ await _repository.InsertAsync(customer);+ //Act+ cart.Parameter = "test";+ await _customerService.UpdateShoppingCartItem(customer.Id, cart);+ //Assert+ Assert.AreEqual("test", _repository.Table.FirstOrDefault(x => x.Id == customer.Id).ShoppingCartItems.FirstOrDefault(x => x.Id == cart.Id).Parameter);+ }+ }+}\ No newline at end of filediff --git a/src/Tests/Grand.Business.Customers.Tests/Services/SalesEmployeeServiceTests.cs b/src/Tests/Grand.Business.Customers.Tests/Services/SalesEmployeeServiceTests.csnew file mode 100644index 000000000..91e9a7829--- /dev/null+++ b/src/Tests/Grand.Business.Customers.Tests/Services/SalesEmployeeServiceTests.cs@@ -0,0 +1,91 @@+using Grand.Data.Tests.MongoDb;+using Grand.Domain.Catalog;+using Grand.Domain.Customers;+using Grand.Domain.Data;+using Grand.Infrastructure.Caching;+using Grand.Infrastructure.Tests.Caching;+using MediatR;+using Microsoft.VisualStudio.TestTools.UnitTesting;+using Moq;++namespace Grand.Business.Customers.Services.Tests+{+ [TestClass()]+ public class SalesEmployeeServiceTests+ {+ private IRepository<SalesEmployee> _repository;+ private MemoryCacheBase _cacheBase;+ private Mock<IMediator> _mediatorMock;+ private SalesEmployeeService _salesEmployeeService;++ [TestInitialize()]+ public void Init()+ {+ _repository = new MongoDBRepositoryTest<SalesEmployee>();+ _mediatorMock = new Mock<IMediator>();++ _cacheBase = new MemoryCacheBase(MemoryCacheTest.Get(), _mediatorMock.Object);+ _salesEmployeeService = new SalesEmployeeService(_repository, _mediatorMock.Object, _cacheBase);+ }+++ [TestMethod()]+ public async Task GetSalesEmployeeByIdTest()+ {+ //Arrange+ var salesEmployee = new SalesEmployee();+ await _repository.InsertAsync(salesEmployee);+ //Act+ var result = await _salesEmployeeService.GetSalesEmployeeById(salesEmployee.Id);+ //Assert+ Assert.IsNotNull(result);+ }++ [TestMethod()]+ public async Task GetAllTest()+ {+ //Arrange+ await _repository.InsertAsync(new SalesEmployee());+ await _repository.InsertAsync(new SalesEmployee());+ await _repository.InsertAsync(new SalesEmployee());+ //Act+ var result = await _salesEmployeeService.GetAll();+ //Assert+ Assert.AreEqual(3, result.Count);+ }++ [TestMethod()]+ public async Task InsertSalesEmployeeTest()+ {+ //Act+ await _salesEmployeeService.InsertSalesEmployee(new SalesEmployee());+ //Assert+ Assert.IsTrue(_repository.Table.Any());+ }++ [TestMethod()]+ public async Task UpdateSalesEmployeeTest()+ {+ //Arrange+ var salesEmployee = new SalesEmployee();+ await _repository.InsertAsync(salesEmployee);+ //Act+ salesEmployee.Email = "[email protected]";+ await _salesEmployeeService.UpdateSalesEmployee(salesEmployee);+ //Assert+ Assert.AreEqual("[email protected]", _repository.Table.FirstOrDefault(x => x.Id == salesEmployee.Id).Email);+ }++ [TestMethod()]+ public async Task DeleteSalesEmployeeTest()+ {+ //Arrange+ var salesEmployee = new SalesEmployee();+ await _repository.InsertAsync(salesEmployee);+ //Act+ await _salesEmployeeService.DeleteSalesEmployee(salesEmployee);+ //Assert+ Assert.IsFalse(_repository.Table.Any());+ }+ }+}\ No newline at end of file