public void GetSingleActionSucceeds()
        {
            // Arrange
            var id = 1L;
            var name = "arbitrary-name";
            var type = typeof(Node);

            var node = new Node
            {
                Id = id,
                Name = name
            };

            var sut = new DataServiceContextBase(new Uri("http://appclusive/api/Core"));

            var methodInfo = Mock.Create<MethodInfo>();
            Mock.Arrange(() => methodInfo.Invoke(Arg.IsAny<object>(), Arg.IsAny<object[]>()))
                .IgnoreInstance()
                .Returns(node)
                .MustBeCalled();

            // Act
            var result = sut.GetSingleEntity(type, id);
            Assert.IsNotNull(result);

            // Assert
            dynamic entity = result;
            Assert.AreEqual(id, entity.Id);
            Assert.AreEqual(name, entity.Name);

            Assert.AreEqual(type.Name, entity.GetType().Name);

            Mock.Assert(methodInfo);
        }
        public void GetVersionReturnsAssemblyVersion()
        {
            // Arrange

            // Act
            var version = DataServiceContextBase.GetVersion();

            // Assert
            Assert.AreEqual(typeof(DataServiceContextBase).Assembly.GetName().Version, version);
        }
        public void GetTenantHeaderNameWithoutSettingBeforeReturnsDefaultTenantHeaderName()
        {
            // Arrange
            var sut = new DataServiceContextBase();

            // Act
            var result = sut.TenantHeaderName;

            // Assert
            Assert.AreEqual(Authentication.Header.DEFAULT_TENANT_HEADER_NAME, result);
        }
        public void GetSingleActionSucceeds()
        {
            // Arrange
            var id   = 1L;
            var name = "arbitrary-name";
            var type = typeof(Node);

            var node = new Node
            {
                Id   = id,
                Name = name
            };

            var sut = new DataServiceContextBase(new Uri("http://appclusive/api/Core"));

            var methodInfo = Mock.Create <MethodInfo>();

            Mock.Arrange(() => methodInfo.Invoke(Arg.IsAny <object>(), Arg.IsAny <object[]>()))
            .IgnoreInstance()
            .Returns(node)
            .MustBeCalled();

            // Act
            var result = sut.GetSingleEntity(type, id);

            Assert.IsNotNull(result);

            // Assert
            dynamic entity = result;

            Assert.AreEqual(id, entity.Id);
            Assert.AreEqual(name, entity.Name);

            Assert.AreEqual(type.Name, entity.GetType().Name);

            Mock.Assert(methodInfo);
        }