コード例 #1
0
        public void ShouldRemoveMonitoringRequest()
        {
            // Arrange
            var repository     = new MonitoringRequestRepository(_fixture.Context);
            var monitorRequest = new MonitorRequest()
            {
                MonitorId = Guid.NewGuid(), ResponseCode = 200
            };

            // Act
            repository.Add(monitorRequest);
            repository.Save();

            monitorRequest = new MonitorRequest()
            {
                MonitorId = Guid.NewGuid(), ResponseCode = 200
            };
            repository.Add(monitorRequest);
            repository.Save();

            repository.Delete(monitorRequest);


            var count = repository.GetAll();


            //Assert
            Assert.Single(count);
        }
コード例 #2
0
        public void ShouldUpdateMonitoringRequest()
        {
            // Arrange
            var repository     = new MonitoringRequestRepository(_fixture.Context);
            var monitorRequest = new MonitorRequest()
            {
                MonitorId = Guid.NewGuid(), ResponseCode = 200
            };

            // Act
            repository.Add(monitorRequest);
            repository.Save();

            monitorRequest.ResponseCode = 500;

            repository.Edit(monitorRequest);
            repository.Save();

            var result = repository.GetById(monitorRequest.Id);

            //Assert
            Assert.Equal(500, result.ResponseCode);
        }