Exemplo n.º 1
0
        public void AcceptanceTest()
        {
            string inputPath = Path.Combine(AppContext.BaseDirectory, "Input1.json");

            ITapDeserializer          tapDeserializer          = new JsonTapDeserializer();
            Mock <IJourneySerializer> mock                     = new();
            IJourneySerializer        customerSerializer       = mock.Object;
            ITravelControler          travelControlerControler = new TravelControler(new Travel(Factory.Zones()), tapDeserializer, customerSerializer, Mock.Of <IPrinter>());

            travelControlerControler.Price(inputPath, String.Empty);

            mock.Setup(x => x.Serialize(It.Is <Journeys>(cs => Equal(cs, CustomerSummaries()))));
        }
Exemplo n.º 2
0
        public void AcceptanceWithGivenFiles()
        {
            string inputPath  = Path.Combine(AppContext.BaseDirectory, "Input2.json");
            string testOutput = File.ReadAllText(Path.Combine(AppContext.BaseDirectory, "Output2.json"));

            ITapDeserializer   tapDeserializer    = new JsonTapDeserializer();
            IJourneySerializer customerSerializer = new JsonJourneySerializer();
            Mock <IPrinter>    mock = new();
            ITravelControler   travelControlerControler = new TravelControler(new Travel(Factory.Zones()), tapDeserializer, customerSerializer, mock.Object);

            travelControlerControler.Price(inputPath, string.Empty);

            mock.Verify(x => x.Print(It.Is <string>(x => EqualJson(x, testOutput)), It.IsAny <string>()));
        }
Exemplo n.º 3
0
        public void SerializeOneTap()
        {
            Mock <ITravel>   mockTravel      = new();
            ITapDeserializer tapDeserializer = new JsonTapDeserializer();

            ITravelControler travelControler = new TravelControler(mockTravel.Object, tapDeserializer, Mock.Of <IJourneySerializer>(), Mock.Of <IPrinter>());

            string inputPath = Path.Combine(AppContext.BaseDirectory, "InputTap.json");

            travelControler.Price(inputPath, string.Empty);

            mockTravel.Verify(x => x.Compute(new List <Tap>
            {
                new() { UnixTimeStamp = 1572242400, CustomerId = 1, Station = @"A" }
            }));