Ejemplo n.º 1
0
        public async Task KluczEditTest()
        {
            var   kluczRepository = new FakeEntityKluczRepository();
            Klucz key             = new Klucz()
            {
                Id   = "0",
                Name = "tak",
                Type = 22,
            };;

            kluczRepository.Add(key);
            var kluczController = new KluczController(kluczRepository);

            var result = await kluczController.Edit(key.Id);

            Assert.IsInstanceOfType(result, typeof(ViewResult));
        }
Ejemplo n.º 2
0
        public async Task KluczEditMoqTest()
        {
            var key1 = new Klucz()
            {
                Id = "0",
            };
            var service = new Mock <IKluczRepository>();

            service.Setup(x => x.GetById("0")).ReturnsAsync(key1);
            var controller = new KluczController(service.Object);

            var result = await controller.Edit(key1.Id);

            var keyModel = ((ViewResult)result).Model as Klucz;

            Assert.AreEqual(key1, keyModel);
        }