Beispiel #1
0
        public void DeleteAsync_IdRecognised_ReturnsTrue()
        {
            var firstEntity = new Employee
            {
                Id = 1,
            };

            var data = new List <Employee>
            {
                firstEntity
            };

            var mockSet       = data.AsQueryable().BuildMockDbSet();
            var mockDbContext = Substitute.For <IDatabaseContext>();

            mockDbContext.Set <Employee>().Returns(mockSet);
            var mockLogger = Substitute.For <ILogger <EmployeeDal> >();
            var dal        = new EmployeeDal(mockDbContext, mockLogger);

            var result = Task.Run(async() => await dal.DeleteAsync(1)).GetAwaiter().GetResult();

            Assert.That(result, Is.True);
        }