コード例 #1
0
        public void RoundtripCassette()
        {
            //arrange
            var sut  = new FileSystemCassetteStorage(_dir);
            var list = new List <HttpInteraction> {
                new HttpInteraction {
                    Request  = HttpRequest.Create(CreateHttpRequestMessage()),
                    Response = HttpResponse.Create(CreateHttpResponseMessage())
                }
            };

            //act
            sut.Save("a cassette", list);

            //assert
            Assert.Single(_dir.GetFiles());

            //act
            var newList = sut.Load("a cassette");

            Assert.Single(newList);
            Assert.False(newList[0].Played);
            Assert.NotNull(newList[0].Request);
            Assert.NotNull(newList[0].Response);
        }
コード例 #2
0
        public void CreatesDirectoryIfNew()
        {
            //arrange + act
            var sut = new FileSystemCassetteStorage(_dir);

            _dir.Refresh();

            //assert
            Assert.True(_dir.Exists);
        }