From what I've learned, when you put そうだ/です before nouns, it becomes そうな, and before verbs, it becomes そうに . However, I've come across a few sentences where そうに is used before a noun instead of そうな .
An example of this I've found: 「田中さんは美味しそうにケーキを食べている」
「ケーキ」is a noun, isn't it? I'm very confused about this.