public async Task GetDetails_ReturnPersonsBusinessModel() { // Arrange personsDataService.Setup(m => m.GetDetails(100)).ReturnsAsync(model); PersonsBusinessService _personsService = new PersonsBusinessService(personsDataService.Object); // Act var result = await _personsService.GetDetails(100); // Assert Assert.That(result, Is.TypeOf <PersonsBusiness>()); }
public void Setup() { // Arrange model = new PersonsData { PersonsID = 1, Name = "AAA", Speed = 20, Size = 20 }; modelBusiness = new PersonsBusiness { PersonsID = 2, Name = "BBB", Color = "Чёрный+зелёный" }; personsDataService = new Mock <IPersonsDataService>(); personsService = new PersonsBusinessService(personsDataService.Object); }
public async Task GetPersons_ReturnListOfPersonsBusinessModel() { // Arrange personsDataService.Setup(m => m.GetPersons("User")).ReturnsAsync(GetTestPersons()); PersonsBusinessService _personsService = new PersonsBusinessService(personsDataService.Object); // Act var result = await _personsService.GetPersons("User"); // Assert Assert.AreEqual(GetTestPersons().Count, result.Count); Assert.That(result, Is.TypeOf <List <PersonsBusiness> >()); }
public void EqualPers_ReturnListOfPersonsBusinessModel() { // Arrange personsDataService.Setup(m => m.EqualPersUpdate("User", 100)).Returns(GetTestPersons()); PersonsBusinessService _personsService = new PersonsBusinessService(personsDataService.Object); // Act var result = _personsService.EqualPers("User", "update", 100); // Assert Assert.AreEqual(GetTestPersons()[0].Size, result[0].Size); Assert.That(result, Is.TypeOf <List <PersonsBusiness> >()); }