Ejemplo n.º 1
0
        public void CreateNewRow()
        {
            JToken obj = new JObject
            {
                ["Id"] = 15
            };

            var objT = new IQueryableType {
                Id = 15
            };

            var resource = new Mock <IOperationResource>();

            resource.Setup(c => c.CreateNewResourceRecord(obj))
            .Returns(objT);

            resourceFactoryMock.Setup(c => c.GetResource("conn1", OperationType.write, "table1"))
            .Returns(resource.Object);

            var result = tableOperations.CreateNewRow("conn1", "table1", obj, loggingService);

            Assert.AreEqual(1, loggingService.LogCount);
            Assert.AreEqual("POST", loggingService.ApiRequests.First().RequestType);
            Assert.AreEqual(15, ((IQueryableType)result).Id);
        }