public void DeleteItemTest() { var builder = new ListControllerTestBuilder(); var service = builder.GetService(); service.Setup(s => s.Create(mockList)) .Returns(ServiceResult <Lista> .SuccessResult(new Lista { Id = 1, Name = "Lista1", Items = new List <string>() })); service.Object.Create(mockList); var result = service.Object.AddItem("flour", 1); var l = new List <string>(); l.Add("flour"); var comp = new Lista { Id = 1, Name = "Lista1", Items = l }; Assert.Equal(result.Result, comp); result = service.Object.RemoveItem("flour", 1); Assert.Equal(result.Result, mockList); }
public void CreateTest() { var builder = new ListControllerTestBuilder(); var service = builder.GetService(); service.Setup(s => s.Create(mockList)) .Returns(ServiceResult <Lista> .SuccessResult(new Lista { Id = 1, Name = "Lista1", Items = new List <string>() })); var result = service.Object.Create(mockList); Assert.Equal(result.Result, mockList); }