Exemple #1
0
        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>());
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        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> >());
        }
Exemple #4
0
        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> >());
        }