public void ShouldAddRecord()
 {
     var record = new Record();
     var result = _sut.Post(record);
     Assert.IsInstanceOf<OkResult>(result);
     _recordRepository.AssertWasCalled(r => r.Add(record));
 }
 public void ShouldAddRecord()
 {
     var count = _records.Count;
     var record = new Record();
     _sut.Add(record);
     Assert.That(_records.Count,Is.EqualTo(count + 1));
     Assert.That(_records.Last(),Is.SameAs(record));
 }
Esempio n. 3
0
        public void ShouldAddRecords()
        {
            var record = new Record{FirstName = "Frank", LastName = "Zappa", BirthDate = new DateTime(1960,1,1), Gender = "Male", FavoriteColor = "Black"};
            var records = _sut.Get() as OkNegotiatedContentResult<IEnumerable<Record>>;
            var initialCount = records.Content.Count();

            var addResult = _sut.Post(record);
            Assert.IsInstanceOf<OkResult>(addResult);

            var results = _sut.Get() as OkNegotiatedContentResult<IEnumerable<Record>>;
            Assert.That(results.Content.Count(), Is.EqualTo(initialCount + 1));
            Assert.That(results.Content.Last().FirstName, Is.EqualTo(record.FirstName));
            Assert.That(results.Content.Last().LastName, Is.EqualTo(record.LastName));
        }
 public void Add(Record record)
 {
     _records.Add(record);
 }
Esempio n. 5
0
 public void Setup()
 {
     _sut = new Record{FirstName = "Ryan", LastName = "Ferretti", Gender = "Male", FavoriteColor = "Green", BirthDate = new DateTime(1981,9,8)};
 }