示例#1
0
        public async Task GetAsync2_ReturnsRecordWithId2()
        {
            //Assert

            //Act
            var result = await testedService.GetAsync(2);

            //Assert
            Assert.Equal(testEntities.ToArray()[2], result);
        }
示例#2
0
        public async Task UnitService_Should_Get_Null_When_Unit_Not_Exist()
        {
            // Arrange
            SetUpUnitOfWork();
            var service = new UnitService(_unitOfWork.Object, _mapper);

            // Act
            var entity = await service.GetAsync((new Random()).Next());

            // Assert
            Assert.Null(entity);
        }
示例#3
0
        public async Task UnitService_Should_Delete_Unit_Async()
        {
            // Arrange
            SetUpUnitOfWork();
            var service = new UnitService(_unitOfWork.Object, _mapper);
            var entity  = new UnitDTO()
            {
                Name      = "TestName",
                ShortName = "TestSN",
            };

            entity = await service.CreateAsync(entity);

            await _unitOfWork.Object.SaveAsync();

            // Act
            await service.DeleteAsync(entity.Id);

            await _unitOfWork.Object.SaveAsync();

            // Assert
            Assert.Null(await service.GetAsync(entity.Id));
        }