コード例 #1
0
        public void When_Getting_File_Name_Then_File_Name_Should_Be_In_Expected_Format()
        {
            //Arrange
            int id           = fixture.Create <int>();
            var messageStore = new MessageStore(Environment.CurrentDirectory);

            //Act
            string actual = messageStore.GetFileName(id);

            //Assert
            var expected = Path.Combine(Environment.CurrentDirectory, id + ".txt");

            actual.Should().BeEquivalentTo(expected);
        }
コード例 #2
0
        public void When_Saving_Message_Then_Message_Should_Be_Stored_In_Specified_File()
        {
            //Arrange
            string expected     = fixture.Create <string>();
            var    messageStore = new MessageStore(Environment.CurrentDirectory);

            //Act
            messageStore.Save(50, expected);

            //Assert
            var textStoredInFile = File.ReadAllText(messageStore.GetFileName(50));

            textStoredInFile.Should().BeEquivalentTo(expected);
        }