상속: DataServiceContextBase
        public void ClientIsNewerMajorClientIsNewerMinor()
        {
            // Arrange
            var clientVersion = new Version(3, 3, 2, 2);
            var serverVersion = new Version(1, 1, 2, 2);

            var communication = Mock.Create <DiagnosticsEndpointCommunication>();

            Mock.Arrange(() => communication
                         .GetBaseUriVersion(Arg.IsAny <System.Data.Services.Client.DataServiceQuery <biz.dfch.CS.Appclusive.Core.OdataServices.Diagnostics.Endpoint> >()))
            .IgnoreInstance()
            .Returns(serverVersion)
            .MustBeCalled();

            var sut = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);

            // Act
            var result = sut.GetSemverCompatibility(clientVersion);

            // Assert
            Mock.Assert(communication);
            Assert.IsFalse(SemverCompatibilityFlags.ServerIsNewer < result);
            Assert.IsFalse(0 != (SemverCompatibilityFlags.BreakingChanges & result) ? true : false);
            Assert.AreEqual(SemverCompatibilityFlags.Compatible, result);
        }
        public void InvokeDiagnosticsAuthenticatedPingSucceeds()
        {
            // Arrange
            var svc = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);

            // Act
            svc.InvokeEntitySetActionWithVoidResult("Endpoints", "AuthenticatedPing", null);

            // Assert
            // Nothing to assert. No exception is all we expect.
        }
        public void InvokeDiagnosticsPingSucceeds()
        {
            // Arrange
            var svc = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);
            svc.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

            // Act
            svc.InvokeEntitySetActionWithVoidResult("Endpoints", "Ping", null);

            // Assert
            // Nothing to assert. No exception is all we expect.
        }
        public void AttachingDetachedEntitySucceeds()
        {
            // Arrange
            var svc = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(new Uri("http://localhost"));
            var entity = new Endpoint();
            Mock.Arrange(() => svc.AttachTo(Arg.AnyString, Arg.AnyObject)).OccursOnce();

            // Act
            svc.AttachIfNeeded(entity);

            // Assert
            Mock.Assert(svc);
        }
        public void InvokeDiagnosticsPingSucceeds()
        {
            // Arrange
            var svc = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);

            svc.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

            // Act
            svc.InvokeEntitySetActionWithVoidResult("Endpoints", "Ping", null);

            // Assert
            // Nothing to assert. No exception is all we expect.
        }
        public void AttachingEntityToInvalidEntitySetThrowsException()
        {
            // Arrange
            var svc = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(new Uri("http://localhost"));
            var entity = new Endpoint();
            var entitySetName = "InvalidEntitySetName";
            Mock.Arrange(() => svc.AttachTo(Arg.AnyString, Arg.AnyObject)).OccursOnce();

            // Act
            svc.AttachIfNeeded(entitySetName, entity);

            // Assert
            Mock.Assert(svc);
        }
        public void AttachingDetachedEntitySucceeds()
        {
            // Arrange
            var svc    = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(new Uri("http://localhost"));
            var entity = new Endpoint();

            Mock.Arrange(() => svc.AttachTo(Arg.AnyString, Arg.AnyObject)).OccursOnce();

            // Act
            svc.AttachIfNeeded(entity);

            // Assert
            Mock.Assert(svc);
        }
        public void AttachingEntityToInvalidEntitySetThrowsException()
        {
            // Arrange
            var svc           = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(new Uri("http://localhost"));
            var entity        = new Endpoint();
            var entitySetName = "InvalidEntitySetName";

            Mock.Arrange(() => svc.AttachTo(Arg.AnyString, Arg.AnyObject)).OccursOnce();

            // Act
            svc.AttachIfNeeded(entitySetName, entity);

            // Assert
            Mock.Assert(svc);
        }
        public void InvokeDiagnosticsTimeWithNonGenericHelperAndEntityAndTypeSucceeds()
        {
            // Arrange
            var svc = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);

            svc.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

            var provider = CultureInfo.InvariantCulture;
            var format   = "yyyy-MM-ddTHH:mm:ss.fffzzz";

            // Act
            var result = svc.InvokeEntitySetActionWithSingleResult(new Endpoint(), "Time", typeof(string), null);

            // Assert
            var expectedDateTimeOffset = DateTimeOffset.ParseExact(result.ToString(), format, provider);

            Assert.IsNotNull(expectedDateTimeOffset);
        }
        public void InvokeDiagnosticsEchoWithGenericHelperSucceeds()
        {
            // Arrange
            var svc = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);

            svc.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

            var content = "arbitraryContent";

            var input = new Hashtable();

            input.Add("Content", content);

            // Act
            var result = svc.InvokeEntitySetActionWithSingleResult <string>(new Endpoint(), "Echo", input);

            // Assert
            Assert.AreEqual(content, result);
        }
        public void LastFieldIsIgnored()
        {
            // Arrange
            var clientVersion = new Version(2, 2, 2, 42);
            var serverVersion = new Version(2, 2, 2, 5);

            var communication = Mock.Create <DiagnosticsEndpointCommunication>();

            Mock.Arrange(() => communication
                         .GetBaseUriVersion(Arg.IsAny <System.Data.Services.Client.DataServiceQuery <biz.dfch.CS.Appclusive.Core.OdataServices.Diagnostics.Endpoint> >()))
            .IgnoreInstance()
            .Returns(serverVersion)
            .MustBeCalled();

            var sut = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);

            // Act
            var result = sut.GetSemverCompatibility(clientVersion);

            // Assert
            Mock.Assert(communication);
            Assert.AreEqual(SemverCompatibilityFlags.Compatible, result);
        }
        public void InvokeDiagnosticsAuthenticatedPingSucceeds()
        {
            // Arrange
            var svc = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);

            // Act
            svc.InvokeEntitySetActionWithVoidResult("Endpoints", "AuthenticatedPing", null);

            // Assert
            // Nothing to assert. No exception is all we expect.
        }
        public void ClientIsNewerMajorClientIsNewerMinor()
        {
            // Arrange
            var clientVersion = new Version(3, 3, 2, 2);
            var serverVersion = new Version(1, 1, 2, 2);

            var communication = Mock.Create<DiagnosticsEndpointCommunication>();
            Mock.Arrange(() => communication
                    .GetBaseUriVersion(Arg.IsAny<System.Data.Services.Client.DataServiceQuery<biz.dfch.CS.Appclusive.Core.OdataServices.Diagnostics.Endpoint>>()))
                .IgnoreInstance()
                .Returns(serverVersion)
                .MustBeCalled();

            var sut = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);
            
            // Act
            var result = sut.GetSemverCompatibility(clientVersion);

            // Assert
            Mock.Assert(communication);
            Assert.IsFalse(SemverCompatibilityFlags.ServerIsNewer < result);
            Assert.IsFalse(0 != (SemverCompatibilityFlags.BreakingChanges & result) ? true : false);
            Assert.AreEqual(SemverCompatibilityFlags.Compatible, result);
        }
        public void LastFieldIsIgnored()
        {
            // Arrange
            var clientVersion = new Version(2, 2, 2, 42);
            var serverVersion = new Version(2, 2, 2, 5);

            var communication = Mock.Create<DiagnosticsEndpointCommunication>();
            Mock.Arrange(() => communication
                    .GetBaseUriVersion(Arg.IsAny<System.Data.Services.Client.DataServiceQuery<biz.dfch.CS.Appclusive.Core.OdataServices.Diagnostics.Endpoint>>()))
                .IgnoreInstance()
                .Returns(serverVersion)
                .MustBeCalled();

            var sut = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);
            
            // Act
            var result = sut.GetSemverCompatibility(clientVersion);

            // Assert
            Mock.Assert(communication);
            Assert.AreEqual(SemverCompatibilityFlags.Compatible, result);
        }
        public void InvokeDiagnosticsTimeWithNonGenericHelperAndEntityAndTypeSucceeds()
        {
            // Arrange
            var svc = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);
            svc.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

            var provider = CultureInfo.InvariantCulture;
            var format = "yyyy-MM-ddTHH:mm:ss.fffzzz";

            // Act
            var result = svc.InvokeEntitySetActionWithSingleResult(new Endpoint(), "Time", typeof(string), null);

            // Assert
            var expectedDateTimeOffset = DateTimeOffset.ParseExact(result.ToString(), format, provider);
            Assert.IsNotNull(expectedDateTimeOffset);
        }
        public void InvokeDiagnosticsEchoWithGenericHelperSucceeds()
        {
            // Arrange
            var svc = new biz.dfch.CS.Appclusive.Api.Diagnostics.Diagnostics(_uri);
            svc.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials;

            var content = "arbitraryContent";

            var input = new Hashtable();
            input.Add("Content", content);

            // Act
            var result = svc.InvokeEntitySetActionWithSingleResult<string>(new Endpoint(), "Echo", input);

            // Assert
            Assert.AreEqual(content, result);
        }