public void CallingGetAssetsWithIdentifierReturnsSingleAsset()
        {
            var sut    = new AssetsController();
            var result = sut.Get("12345");

            Assert.NotNull(result);
            Assert.IsInstanceOf <IActionResult>(result);
            Assert.IsInstanceOf <OkObjectResult>(result);

            var okResult = result as OkObjectResult;

            StringAssert.Contains("\"identifier\":\"12345\"", okResult.Value.ToString());
        }
        public void CallingGetAssetsWithoutIdentifierReturnsAssetList()
        {
            var sut    = new AssetsController();
            var result = sut.Get();

            Assert.NotNull(result);
            Assert.IsInstanceOf <IActionResult>(result);
            Assert.IsInstanceOf <OkObjectResult>(result);

            var okResult = result as OkObjectResult;

            StringAssert.Contains("_links", okResult.Value.ToString());
        }
Esempio n. 3
0
        public void GetAssets_Test()
        {
            AssetsController controler = new AssetsController();


            RavenSession.Store(new Owner {
                Email = "*****@*****.**", Id = 1, Name = "Tester", UserName = "******"
            });
            RavenSession.Store(new Asset {
                OwnerId = 1, Id = 1, Name = "Asset1"
            });

            RavenSession.SaveChanges();

            controler.RavenSession = RavenSession;
            var result = controler.Get();

            Assert.AreEqual(result.Count(), 1);

            CleanUp();
        }