public void TestSendDeleteOperationRetry()
        {
            var data = new StreamingEndpointData { Name = "testData", Id = "1" };

            var fakeException = new WebException("test", WebExceptionStatus.ConnectionClosed);

            var dataContextMock = TestMediaServicesClassFactory.CreateSaveChangesMock(fakeException, 2, data);

            dataContextMock.Setup((ctxt) => ctxt.AttachTo("StreamingEndpoints", data));
            dataContextMock.Setup((ctxt) => ctxt.DeleteObject(data));

            _mediaContext.MediaServicesClassFactory = new TestMediaServicesClassFactory(dataContextMock.Object);

            data.SetMediaContext(_mediaContext);

            try
            {
                data.SendDeleteOperation();
            }
            catch (NotImplementedException x)
            {
                Assert.AreEqual(TestMediaDataServiceResponse.TestMediaDataServiceResponseExceptionMessage, x.Message);
            }

            dataContextMock.Verify((ctxt) => ctxt.SaveChanges(), Times.Exactly(2));
        }
        public void TestDeleteRetry()
        {
            var data = new StreamingEndpointData { Name = "testData", Id = "1" };

            var fakeException = new WebException("test", WebExceptionStatus.ConnectionClosed);

            var dataContextMock = TestMediaServicesClassFactory.CreateSaveChangesMock(fakeException, 2, data);

            dataContextMock.Setup((ctxt) => ctxt.AttachTo("StreamingEndpoints", data));
            dataContextMock.Setup((ctxt) => ctxt.DeleteObject(data));

            _mediaContext.MediaServicesClassFactory = new TestMediaServicesClassFactory(dataContextMock.Object);

            data.SetMediaContext(_mediaContext);

            try
            {
                data.Delete();
            }
            catch (NotImplementedException x)
            {
                Assert.AreEqual(TestMediaDataServiceResponse.TestMediaDataServiceResponseExceptionMessage, x.Message);
            }

            dataContextMock.Verify((ctxt) => ctxt.SaveChangesAsync(data), Times.Exactly(2));
        }
        public void SettingsTestSubProperties()
        {
            IStreamingEndpoint target = new StreamingEndpointData();

            var settings = new StreamingEndpointCacheControl
            {
                MaxAge = TimeSpan.FromMinutes(1)
            };

            target.CacheControl = settings;

            Assert.AreEqual(60, target.CacheControl.MaxAge.Value.TotalSeconds);
        }
        public void SettingsTestSubProperties()
        {
            IStreamingEndpoint target = new StreamingEndpointData();

            var settings = new StreamingEndpointCacheControl
            {
                MaxAge = TimeSpan.FromMinutes(1)
            };

            target.CacheControl = settings;

            Assert.AreEqual(60, target.CacheControl.MaxAge.Value.TotalSeconds);
        }