示例#1
0
        //private void TestWithBothDatastores(Action<IDatastore> test) {
        //    test(GetDatastoreWithFakeData());
        //    test(GetDatastore());
        //}

        private void TestAccountAndPassword(IDatastore dataStore, AccountDto accountDto)
        {
            dataStore.GetAllAccountIds().Should().Contain(id => id.Equals(accountDto.Id));
            dataStore.GetAccountDtos().Should().Contain(dataStoreAccountDto => accountDto.Id == dataStoreAccountDto.Id);
            dataStore.GetAccountDto(accountDto.Id).Equals(accountDto).Should().BeTrue();
            dataStore.GetAccountDto(accountDto.Id).IsDeleted.Should().Be(accountDto.IsDeleted);
            dataStore.GetAccountDto(accountDto.Id).Id.Should().Be(accountDto.Id);
            dataStore.GetAccountDto(accountDto.Id).LastChangedUtc.Should().Be(accountDto.LastChangedUtc);
            dataStore.GetAccountDto(accountDto.Id).Notes.Should().Be(accountDto.Notes);
            dataStore.GetAccountDto(accountDto.Id).ProviderKey.Should().Be(accountDto.ProviderKey);
            dataStore.GetAccountDto(accountDto.Id).Tags.Should().Equal(accountDto.Tags);
            dataStore.GetAccountDto(accountDto.Id).Fields.Should().Equal(accountDto.Fields);
            //dataStore.GetPasswordDtos(accountDto.Id).Should().HaveCount(passwordDtos.Count());
            //dataStore.GetPasswordDtos(accountDto.Id).First().Equals(passwordDtos.First()).Should().BeTrue();
            //dataStore.GetPasswordDtos(accountDto.Id).Should().Equal(passwordDtos);
        }
示例#2
0
        public void WhenAddingASingleAccount_ItShouldBeAdded()
        {
            // Given
            var facebookAccount  = FakeData.FakeDataGenerator.GetFacebookAccount();
            var facebookPassword = FakeData.FakeDataGenerator.GetFacebookPassword();

            facebookAccount.Fields.Add(facebookPassword);

            IDatastore originalDatastore = null;

            // When
            TestWithEmptyDatastore(dataStore => {
                dataStore.SaveAccountDto(facebookAccount);
                originalDatastore = dataStore;
            });

            // Then
            originalDatastore.GetAllAccountIds().Should().HaveCount(1);
            originalDatastore.GetAccountDtos().Should().HaveCount(1);
            TestAccountAndPassword(originalDatastore, facebookAccount);
        }
示例#3
0
 //private void TestWithBothDatastores(Action<IDatastore> test) {
 //    test(GetDatastoreWithFakeData());
 //    test(GetDatastore());
 //}
 private void TestAccountAndPassword(IDatastore dataStore, AccountDto accountDto)
 {
     dataStore.GetAllAccountIds().Should().Contain(id => id.Equals(accountDto.Id));
     dataStore.GetAccountDtos().Should().Contain(dataStoreAccountDto => accountDto.Id == dataStoreAccountDto.Id);
     dataStore.GetAccountDto(accountDto.Id).Equals(accountDto).Should().BeTrue();
     dataStore.GetAccountDto(accountDto.Id).IsDeleted.Should().Be(accountDto.IsDeleted);
     dataStore.GetAccountDto(accountDto.Id).Id.Should().Be(accountDto.Id);
     dataStore.GetAccountDto(accountDto.Id).LastChangedUtc.Should().Be(accountDto.LastChangedUtc);
     dataStore.GetAccountDto(accountDto.Id).Notes.Should().Be(accountDto.Notes);
     dataStore.GetAccountDto(accountDto.Id).ProviderKey.Should().Be(accountDto.ProviderKey);
     dataStore.GetAccountDto(accountDto.Id).Tags.Should().Equal(accountDto.Tags);
     dataStore.GetAccountDto(accountDto.Id).Fields.Should().Equal(accountDto.Fields);
     //dataStore.GetPasswordDtos(accountDto.Id).Should().HaveCount(passwordDtos.Count());
     //dataStore.GetPasswordDtos(accountDto.Id).First().Equals(passwordDtos.First()).Should().BeTrue();
     //dataStore.GetPasswordDtos(accountDto.Id).Should().Equal(passwordDtos);
 }