//[TestMethod] public async Task KluczIndexMoqTest() { var key1 = new Klucz() { Id = "0", }; var key2 = new Klucz() { Id = "1", }; var keys = new List <Klucz>(); keys.Add(key1); keys.Add(key2); var service = new Mock <IKluczRepository>(); service.Setup(x => x.GetById("0")).ReturnsAsync(key1); service.Setup(x => x.GetById("1")).ReturnsAsync(key2); var controller = new KluczController(service.Object); var result = await controller.Index(); var keyModel = ((ViewResult)result).Model as IList <Klucz>; //CollectionAssert.AreEqual(keys, keyModel); Assert.IsInstanceOfType(keyModel, typeof(IList <Klucz>)); }
public async Task KluczIndexTest() { var kluczRepository = new FakeEntityKluczRepository(); var kluczController = new KluczController(kluczRepository); var result = await kluczController.Index(); Assert.IsInstanceOfType(result, typeof(ViewResult)); }