コード例 #1
0
        public async Task GetSmartLockUsers_EmptySmartLockId_ThrowsArgumentException()
        {
            var options = new DbContextOptionsBuilder <ApiContext>()
                          .UseInMemoryDatabase("TestDbInMemory")
                          .Options;

            await using (var context = new ApiContext(options))
            {
                var smartLockRepository = new SmartLockRepository(context);

                // Assert
                await Assert.ThrowsAsync <ArgumentNullException>(
                    // Act
                    () => smartLockRepository.GetSmartLockUsers(Guid.Empty));
            }
        }
コード例 #2
0
        public void AddSmartLockUser_SmartLockIdIsEmpty_ThrowsArgumentException()
        {
            var options = new DbContextOptionsBuilder <ApiContext>()
                          .UseInMemoryDatabase("TestDbInMemory")
                          .Options;

            using (var context = new ApiContext(options))
            {
                var smartLockRepository = new SmartLockRepository(context);

                // Assert
                Assert.Throws <ArgumentNullException>(
                    // Act
                    () => smartLockRepository.AddSmartLockUser(Guid.Empty, Guid.NewGuid()));
            }
        }
コード例 #3
0
        public async Task SmartLockGroupExists_UserIdIsEmpty_ThrowsArgumentException()
        {
            var options = new DbContextOptionsBuilder <ApiContext>()
                          .UseInMemoryDatabase("TestDbInMemory2")
                          .Options;

            await using (var context = new ApiContext(options))
            {
                var smartLockRepository = new SmartLockRepository(context);

                // Assert
                await Assert.ThrowsAsync <ArgumentNullException>(
                    // Act
                    () => smartLockRepository.SmartLockGroupExists(Guid.NewGuid(), Guid.Empty));
            }
        }