Esempio n. 1
0
        public void OnCreateUserWillReturnATask()
        {
            var helloWorldData = new SimpleAuthenticationJsonDataRepository();

            var fileReader = new Mock <IFileReader>();

            helloWorldData.FileReader = fileReader.Object;

            var result = helloWorldData.StoreUser("jsmith");

            Assert.IsTrue(result.IsCompleted);
        }
Esempio n. 2
0
        public void OnCreateUserWillWriteJsonToFile()
        {
            var helloWorldData = new SimpleAuthenticationJsonDataRepository();

            var fileReader = new Mock <IFileReader>();

            helloWorldData.FileReader = fileReader.Object;

            var userInformation = new UserInformation
            {
                LoginName = "jsmith"
            };

            var json = JsonConvert.SerializeObject(userInformation);

            fileReader.Setup(x => x.WriteToFile(json));

            helloWorldData.StoreUser("jsmith");

            fileReader.VerifyAll();
        }