Ejemplo n.º 1
0
        public async Task ItCanWriteUpAndDownAnAsset()
        {
            var currentDate = new DateTime(DateTime.UtcNow.Year, DateTime.UtcNow.Month, 1);
            var request     = new FortnoxApiRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret);
            var result      = await AssetsService.GetAssetAsync(request, "4");

            Assert.AreEqual("2", result.Number);

            var writeUp = new WriteUpOrDownAsset {
                Amount = 300, Comment = "WriteUp, Possible comment", Date = currentDate.AddMonths(1)
            };
            var writeUpAsset = await AssetsService.WriteUpAssetAsync(request, $"{result.Id}", writeUp);

            var latestWriteUp = writeUpAsset.History.Where(e => e.Date.Equals(writeUp.Date)).First();

            Assert.IsTrue(latestWriteUp.Notes.Contains(writeUp.Comment));

            var writeDown = new WriteUpOrDownAsset {
                Amount = 200, Comment = "WriteDown, Possible comment", Date = currentDate.AddMonths(1)
            };
            var writeDownAsset = await AssetsService.WriteDownAssetAsync(request, $"{result.Id}", writeDown);

            var latestWriteDown = writeDownAsset.History.Where(e => e.Date.Equals(writeDown.Date)).Last();

            Assert.IsTrue(latestWriteDown.Notes.Contains(writeDown.Comment));
        }
Ejemplo n.º 2
0
        public async Task ItCanGetAnAsset()
        {
            var request = new FortnoxApiRequest(this.connectionSettings.AccessToken, this.connectionSettings.ClientSecret);
            var result  = await AssetsService.GetAssetAsync(request, "1");

            Assert.AreEqual("1", result.Number);
        }