Exemplo n.º 1
0
        public async void UpdateBike()
        {
            var connection = new SqlConnection(Secrets.SqlString);

            var registerBike = QuickDapper.RegisterTable <Bike>();

            Assert.NotNull(registerBike.QueryString);
            Assert.NotNull(registerBike.InsertString);

            var sampleBike = new Bike()
            {
                Model        = "Z800",
                Manufacturer = "Kawasaki",
                Mileage      = 0
            };

            var result = await connection.CreateAsync <Bike>(sampleBike);

            Assert.True(result > 0);

            var trashedZ = new UglyTrashedZ() //Really, who likes those bikes?
            {
                BikeNumber = 3,
                Mileage    = 99999999
            };

            var update = await connection.UpdatePartialAsync <UglyTrashedZ>(trashedZ);

            Assert.True(update > 0);

            connection.Close();
        }
Exemplo n.º 2
0
        public void RegisterPartial()
        {
            var registerBike = QuickDapper.RegisterTable <Bike>();

            Assert.NotNull(registerBike.QueryString);
            Assert.NotNull(registerBike.InsertString);
            Assert.NotNull(registerBike.UpdateString);

            var registerMiniBike = QuickDapper.RegisterPartial <BikeMini>();

            Assert.NotNull(registerMiniBike.QueryString);
            Assert.NotNull(registerMiniBike.InsertString);
            Assert.NotNull(registerMiniBike.UpdateString);
        }
Exemplo n.º 3
0
        public void RegisterTables()
        {
            var registerBike = QuickDapper.RegisterTable <Bike>();

            Assert.NotNull(registerBike.QueryString);
            Assert.NotNull(registerBike.InsertString);
            Assert.NotNull(registerBike.UpdateString);

            var registerEvent = QuickDapper.RegisterTable <Event>();

            Assert.NotNull(registerEvent.QueryString);
            Assert.NotNull(registerEvent.InsertString);
            Assert.NotNull(registerEvent.UpdateString);

            var registerTrack = QuickDapper.RegisterTable <Track>();

            Assert.NotNull(registerTrack.QueryString);
            Assert.NotNull(registerTrack.InsertString);
            Assert.NotNull(registerTrack.UpdateString);
        }
Exemplo n.º 4
0
        public async void CreateBike()
        {
            var connection = new SqlConnection(Secrets.SqlString);

            var registerBike = QuickDapper.RegisterTable <Bike>();

            Assert.NotNull(registerBike.QueryString);
            Assert.NotNull(registerBike.InsertString);

            var sampleBike = new Bike()
            {
                Model        = "Z800",
                Manufacturer = "Kawasaki",
                Mileage      = 0
            };

            var result = await connection.CreateAsync <Bike>(sampleBike);

            Assert.True(result > 0);

            connection.Close();
        }
Exemplo n.º 5
0
        public async void SelectBike()
        {
            var connection = new SqlConnection(Secrets.SqlString);

            var registerBike     = QuickDapper.RegisterTable <Bike>();
            var registerMiniBike = QuickDapper.RegisterPartial <BikeMini>();

            Assert.NotNull(registerBike.QueryString);
            Assert.NotNull(registerMiniBike.QueryString);

            var bikes = await connection.GetAll <Bike>();

            var thundercat = await connection.FindOne <Bike>(1);

            var miniCat = await connection.FindOne <BikeMini>(1);

            Assert.NotNull(bikes);
            Assert.NotNull(thundercat);
            Assert.NotNull(miniCat);

            connection.Close();
        }