Пример #1
0
        public static SomePoco Run(IConfiguration config)
        {
            var result = new SomePoco();

            config.GetSection("Program").Bind(result);

            return(result); // result now has the values from our configuration.
        }
    static void Main(string[] args)
    {
        var classInstance = new SomePoco()
        {
            FirstName = "Bob"
        };
        var tableNameAttribute = classInstance.GetAttribute <TableNameAttribute>();

        Console.WriteLine(tableNameAttribute != null ? tableNameAttribute.TableName : "null");
        Console.ReadKey(true);
    }
Пример #3
0
        public void jakes_serilization_of_jobject_issue()
        {
            ClearDefaultTable();

            var poco = new SomePoco
                {
                    Data = new JObject
                        {
                            ["blah"] = new JArray("one", "two", "three")
                        }
                };

            var result = R.Db(DbName).Table(TableName).Insert(poco).RunResult(conn);
            result.AssertInserted(1);
        }
Пример #4
0
        public void ShouldBeAbleToDeserializeStream()
        {
            // Arrange
            var src = new SomePoco()
            {
                Id = 2, Value = "some value"
            };
            var srcJson   = JsonConvert.SerializeObject(src);
            var memStream = new MemoryStream(Encoding.UTF8.GetBytes(srcJson));
            // Act
            var result = memStream.As <SomePoco>();

            // Assert
            Expect(result).To.Deep.Equal(src);
        }
Пример #5
0
        public void jakes_serilization_of_jobject_issue()
        {
            ClearDefaultTable();

            var poco = new SomePoco
            {
                Data = new JObject
                {
                    ["blah"] = new JArray("one", "two", "three")
                }
            };

            var result = R.Db(DbName).Table(TableName).Insert(poco).RunResult(conn);

            result.AssertInserted(1);
        }
Пример #6
0
        public void TestMethod1()
        {
            //Mock<IDataRepository> moqRepo =
            //    new Mock<IDataRepository>();
            Guid id = Guid.NewGuid();
            //moqRepo.Setup(
            //    repo => repo.Read(id))
            //    .Returns(
            //    new SomePoco()
            //    {
            //        Id = id,
            //        Name = "Joe Smith"
            //    });


            IDataRepository repo = new DataRepository();


            SomePocoLogic logic =
                new SomePocoLogic(repo);
            SomePoco poco = logic.Read(id);

            Assert.AreEqual("Joe Smith", poco.Name);
        }
 public IHttpActionResult Put(SomePoco somePoco)
 {
     return(Created($"blah/{somePoco.Id}", somePoco));
 }