Esempio n. 1
0
        protected override async Task PerformIntegrationTest(ITestClient testClient)
        {
            //arrange
            var payload = new byte[] { 50, 20, 30 };
            var apiUrl  = "/Backup";

            //info page should contain infos to urls
            var str = await testClient.GetAsync(apiUrl);

            Assert.IsNotNull(str);
            Assert.IsTrue(str.Contains(apiUrl));

            //download original db
            var originalDb = await testClient.GetFileAsync(apiUrl + "/db.sqlite");

            Assert.IsNotNull(originalDb);
            Assert.IsTrue(originalDb.Length > 0);

            //replace db with own file
            var replaceResponse = await testClient.PostFileAsync(apiUrl + "/post", payload);

            Assert.IsNotNull(replaceResponse);
            Assert.IsTrue(replaceResponse.ToLower().Contains("true"));

            //check that replace was successful
            var replaceDb = await testClient.GetFileAsync(apiUrl + "/db.sqlite");

            CheckArraysMatch(payload, replaceDb);

            //check that backup was successful
            var backupDb = await testClient.GetFileAsync(apiUrl + "/db.sqlite_backup");

            CheckArraysMatch(originalDb, backupDb);
        }
Esempio n. 2
0
        public async Task <IActionResult> GetAsync()
        {
            var result1 = await _welcomeClient.GetAsync();

            var result = await _client.GetAsync();

            return(Ok(result));
        }