public void SaveCallShouldIncreaseCount()
        {
            SetupTestDirectory();
            var repository = new CallFileRepository(_directoryName);
            var call = CreateTestCall();

            repository.SaveCall(call);

            Assert.That(repository.Count, Is.EqualTo(1));
        }
        public void ShouldFindExistingCall()
        {
            SetupTestDirectory();
            var saveFileRepository = new CallFileRepository(_directoryName);
            var input = new CallInput { TargetType = "TestTargetType", Method = "TestMethod", Arguments = new object[] { 1234L, null, DateTime.Now } };
            var inputCall = new Call { Input = input, Result = new CallResult { Return = SampleObject.GetSampleObject() } };
            saveFileRepository.SaveCall(inputCall);

            var getFileRepository = new CallFileRepository(_directoryName);
            var outputCall = getFileRepository.GetCall(input);

            Assert.That(outputCall, Is.EqualTo(inputCall));
        }
        public void CtorShouldReadInExistingCallsInDirectory()
        {
            SetupTestDirectory();
            var call = new Call { Input = CallInput.CreateWithNextCallNumber() };
            var fileName = Path.Combine(_directoryName, "tmp.json");
            CallFileRepository.SaveCallToFile(call, fileName);

            var repository = new CallFileRepository(_directoryName);

            Assert.That(repository.Count, Is.EqualTo(1));
        }
        public void SaveCallShouldSaveFileInDirectory()
        {
            SetupTestDirectory();
            var repository = new CallFileRepository(_directoryName);
            var call = CreateTestCall();

            repository.SaveCall(call);

            var actual = Directory.GetFiles(_directoryName, "*.json").Length;
            Assert.That(actual, Is.EqualTo(1));
        }