public static void GeneratePyramid_ValidInput_GeneratesPyramid([Frozen] Mock <IFileHelper> fileHelper, string path, PyramidReader sut) { var pyramidText = $"12@14 55@13 40 11".Replace("@", Environment.NewLine); fileHelper.Setup(fr => fr.FileExists(path)).Returns(true); fileHelper.Setup(fr => fr.ReadAllText(path)).Returns(pyramidText); var section = sut.GeneratePyramidSections(path); section.Should().NotBeNull(); section.Previous.Should().NotBeNull(); }
public static void GeneratePyramid_FileDoesntExist_ThrowsFileNotFoundException([Frozen] Mock <IFileHelper> fileHelper, string path, PyramidReader sut) { fileHelper.Setup(fr => fr.FileExists(path)).Returns(false); Assert.Throws <FileNotFoundException>(() => sut.GeneratePyramidSections(path)); }
public static void GeneratePyramid_TopLayerLengthIsNotOne_ThrowsArgumentException([Frozen] Mock <IFileHelper> fileHelper, string path, PyramidReader sut) { var pyramidText = $"12 22@14 55@13 40 11".Replace("@", Environment.NewLine); fileHelper.Setup(fr => fr.FileExists(path)).Returns(true); fileHelper.Setup(fr => fr.ReadAllText(path)).Returns(pyramidText); Assert.Throws <ArgumentException>(() => sut.GeneratePyramidSections(path)); }
public static void GeneratePyramid_InvalidInput_ThrowsException([Frozen] Mock <IFileHelper> fileHelper, string file, string path, PyramidReader sut) { fileHelper.Setup(fr => fr.FileExists(path)).Returns(true); fileHelper.Setup(fr => fr.ReadAllText(path)).Returns(file); Assert.Throws <ArgumentException>(() => sut.GeneratePyramidSections(path)); }