Как издеваться над IUrlHelper

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class FileWriterExample {
    public static void main(String [] args) {
        FileWriter fw= null;
        File file =null;
        try {
            file=new File("WriteFile.txt");
            if(!file.exists()) {
                file.createNewFile();
            }
            fw = new FileWriter(file);
            fw.write("This is an string written to a file");
            fw.flush();
            fw.close();
            System.out.println("File written Succesfully");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
0
задан Johnny 25 March 2019 в 14:49
поделиться

1 ответ

Если вы все еще хотите проверить свой IUrlHelper, вы можете использовать этот код

var mocked = new Mock<IUrlHelper>();

mocked.Setup(x => x.Page(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<object>(), It.IsAny<string>()))
                    .Returns("whatever_string");

IUrlHelper helper = mocked.Object;
0
ответ дан xneg 25 March 2019 в 14:49
поделиться
Другие вопросы по тегам:

Похожие вопросы: