Exemplo n.º 1
0
        public void IncrementsKey()
        {
            var fileCollection = new SimpleFileCollection <RecordStub>();
            var testRecord1    = new RecordStub();
            var testRecord2    = new RecordStub();

            fileCollection.Add(testRecord1);
            fileCollection.Add(testRecord2);
            testRecord1.Key.ShouldBe(0);
            testRecord2.Key.ShouldBe(1);
        }
Exemplo n.º 2
0
        public void CanAddRecord()
        {
            var fileCollection = new SimpleFileCollection <RecordStub>();
            var testRecord     = new RecordStub {
                TestValue = "This is a test"
            };

            fileCollection.Add(testRecord);
            var records = fileCollection.ToList();

            records.ShouldContain(Is(testRecord));
        }
Exemplo n.º 3
0
        public void CanUpdateRecord()
        {
            const string previousValue  = "Test 1";
            const string newValue       = "Test 2";
            var          fileCollection = new SimpleFileCollection <RecordStub>();
            var          testRecord     = new RecordStub {
                TestValue = previousValue
            };

            fileCollection.Add(testRecord);
            var addedRecord = fileCollection.SingleOrDefault(Matches(testRecord));

            addedRecord.TestValue.ShouldBe(previousValue);

            testRecord.TestValue = newValue;
            fileCollection.Update(testRecord);
            var updatedRecord = fileCollection.SingleOrDefault(Matches(testRecord));

            updatedRecord.TestValue.ShouldBe(newValue);
        }