public int Update( MyModel model) { this.internalHash[model.Id] = model; return 1; }
public void DoSomething() { try { var model = new MyModel(); var repository = new FakeRepository(); repository.Add(model); var service = new MyService(repository); var result = service.DoSomething(); Trace.WriteLine(result); Assert.AreEqual(2, result); var data = repository.Get(); Assert.IsNotNull(data); Assert.IsTrue(data.Any()); Assert.AreEqual(2, data.Count()); } catch (Exception exception) { Trace.WriteLine(exception); Assert.Fail(exception.Message); } }
public int Add( MyModel model) { var newId = 0; if (this.internalHash.Any()) { newId = this.internalHash.Keys.Max(); } newId++; var clone = new MyModel { Name = model.Name }; this.internalHash.Add(newId, clone); return newId; }
public int Update( MyModel model) { throw new NotImplementedException(); }